I'm sure there is a way around it, but why do you want to do it that way anyways?
I know that if you use $PHP_AUTH_USER and $PHP_AUTH_PASS
(I believe those are the fileds), then it will for sure log out the user when they close the browser, but don't think it will if they just visit another page.
A possible way around this is:
Will finish this later.