I believe this is better off handled using a custom menu, by modifying the Close command to issue the prompt.
Also, don't exit the FMP application, just close the window. An assumption is being made that your window is the only one that the user has open. I find nothing more annoying than closing somebody's database only to find that it quits the whole application. The horror!