Edit AllPages

I have been developing an app with several type of inter-relating document windows and one non-doc sort of panel that remains available during the life of the program. My question is, when the user quits, how can I make sure that panel closes last, so if the user cancels the exit, that panel will still be there? Any ideas?