WebPage.Close
From Xojo Documentation
Event
The page is about to close.
Notes
This can happen when the user closes the browser window or tab containing your web app. You can use this event handler for any cleanup that you need to do when this happens.