Assuming you are writing an xll and not a VBA add-in, see the full story at http://xllblog.wordpress.com/2013/07/10/add-in-manager/.
Long story short, File>Open...
only calls xlAutoOpen
. The Add-in Manager calls xlAutoAdd
then xlAutoOpen
when you add the file, and xlAutoRemove
then xlAutoClose
when you remove the file.