WebApplication.Close
From Xojo Documentation
Event
The web app is quitting.
Notes
CGI web apps automatically quit when there are no connected sessions (see WebApplication.AutoQuit) and are restarted as necessary by the web server.
Session is not available from this event handler.