Before answering Joe's question, I would like to remind the readers that keyboard commands and mouse clicks are not the only reason TC shuts down. Windows itself too, sometimes decides to shutdown or restart. Network admin actions, e.g, or simply inactivity, are events that once detected give TC precious little time to finish up either TCExit or anything else it started!
1. When you have a document opened with unsaved text in - say - Word or Notepad, the program will not close, but will display a dialog first asking if you want to save the document. Only after closing this dialog, the program will end (gracefully).
2. In case Windows will shutdown for one reason or another, at first it will try to shut down the program gracefully (like "taskkill"), but after around 20 seconds if will force the program to end anyway ("taskkill /f")
So, start TCEXIT with @fileopen a dummy text-file, @filewrite some text in it (don't save it!), execute the rest of TCEXIT, anwer (or kill) the Save file?-dialog, close the filehandle and done.
TCEXIT will stay alive till the end (assuming the 20 seconds in case of a Windows shutdown will be enough to finish your TCEXIT tasks).
But alas, Take Command closes the open filehandle all by itself (no more open handles in Process Explorer afterwards).
Extra points for Take Command, but unfortunate for this scenario.
(OR I just don't grasp the inner workings of the @filopen-commands. That is very(!) well possible. Maybe someonbe can enlighten me? )
I wrote this down because maybe, just maybe, it can inspire some other solution.