There are different ways to do this, but the server can't detect when de browser gets closed so destroying it then is hard.
Either create a new session with the current time or add a time variable to the current session. and then check it when you start up or perform an action to see if the session has to be removed.
session_start();
$_SESSION["timeout"] = time();
//if 100 seconds have passed since creating session delete it.
if(time() - $_SESSION["timeout"] > 100){
unset($_SESSION["timeout"];
}
Make javascript perform an ajax call that will delete the session, with onbeforeunload()
a javascript function that calls a final action when the user leaves the page. For some reason this doesnt always work though.
If you always want the user to see the login page on startup after the page has been closed you can just delete the session on startup.
<? php
session_start();
unset($_SESSION["session"]);
and there probably are some more.