If you close the browser without logout or session expired function, the session will be remain in server. But next time the server generate new session id for the next request.
When the user closes the page or logs out. You need to clear the session variable with something like (since you didnt tag the language you are working on)
or you set the session value to null.
Now when a user closes the page the global.asax methods gets fired. The method which is getting fired is