title: PHP Session expire event
body: <p>I am trying to make some changes to an opensource project. I want to keep track of when users log in and log out. 
  Right now I change their login status in db when they login or manually log out. The problem right now is that I cannot find out if the user just closed their browser without pressing on logout button. 
  For this reason I need to trigger a function that will change database every time the user's session expires.
  I've tried <code>session_set_save_handler</code> in PHP, but it looks like I need to override the whole session behavior. What I am looking for is to keep default session behavior and just add functionality when the user's session expires. Is there a way to do that?</p>