Unless a logout button is pressed, so that script can be executed to notify the database that the user has logged out, this can prove to be difficult.
If the user simply logs out by closing the browser the database cannot be notified that the logout has occurred.
You would probably need to look at a time sensitive task that checks for session activity, probably through a cron job. You would then need to decide what length of time was adequate for a logout.
Of course, if you set this to 30 mins and the user tried to login 10 minutes after closing the browser then they would be restricted and unable to access the site.
Hope this makes sense?