You need javascript for that. But i am not sure if when the line "window.close();" executes, that the window will be closed; A messagebox may popup to the user to confirm whether or not to close.
Also i do not know what happens if the user has not javascripting enabled.
It is better than closing the window, to redirect the user to the login page (the auth cookie will have expired when session ends).