Also call TROOT::CloseFiles as a atexit function.  This reduces the risk of problem when ::exit is called explicitly.  However this solution still requires at least one TApplication to be created and since atexit (on linux/macos) are in order, this is still technically too late.  The library that are loaded dynamically (gSystem->Load, dlopen) will be unloaded before the atexit installed by TApplication (at the start of the main).  What we really need is to call exactly after the end of the main and before the first library (with a dictionary) is unloaded [which we could do if (and only if) we know how to cheaply know that the library is being unloaded after main


git-svn-id: https://root.cern.ch/svn/root/trunk@48236 27541ba8-7e3a-0410-8455-c3a389f83636
Add missing header


git-svn-id: https://root.cern.ch/svn/root/trunk@48237 27541ba8-7e3a-0410-8455-c3a389f83636