Shortly: you can not.
As web applications use http, and http is stateless, you can not know for sure what happens on client side, since there is no connection between client and server. The only thing that can be used to keep track of it is the session. And the session is kept by the server as long as it was set up to be kept, or the application is closing it.
So if you want to close the session, you have to initiate it from the server. Thus the server side part of your application has to be notified about browser closure. Deleting the session cookie on client side won't close the session on server side.
You might try to catch events like leaving your site, closing a browser window, but this is only part of the situations how the user could leave your application: might loose network connection, kill the browser, browser might crash, and so on. These event will be never caught by your application. Thus you can not rely on client side.
Although you can use the normal events, but be aware, that there is no guarantee, that these will arrive on server side. Read this article: Window Close Event of Browser
What you also can do:
- optimize session timeout
- give a countdown timer to the user and warn him, if time is running out (and do an ajax postback if user wants to continue)
- do automatic keepalive postbacks (be careful not to use this if slow or expensive connection is in place)
- encourage the user to log out