From Xojo Documentation
The Window is about to close. You cannot cancel the closing at this time. If you need to decide or interact with the user to make sure that the Window should be closed, use Window.CancelClose event instead which is called before Window.Close.
- Description of the termination process in Application.CancelClose.