Basically, you can either open another window or submit a request to a server, using onunload handler, but that pretty much it.
Besides, what if user turns of a computer?
You should rethink your server side.
Use session timeout setting, seeeion listeners if you need to clean up something when session invalidates and so on.