WebSession.Close
From Xojo Documentation
Event
The current session is closing.
Notes
This is where you do any cleanup after a session has closed.
A session is closed automatically when the user navigates away from your app. This could be by navigating to another URL or by closing the tab or window. You can manually end a session by redirecting the user away from the app yourself using ShowURL. The session automatically closes 3 minutes after they navigate away. If the user returns to your app (via Back or re-entering the URL) before the timeout, then the session will still be available for use.