It (depending on browser differences) shouldnt be necesarry to close the window.
Whats going on behind the scenes is calling a client side script
This client code flushes the in-memory cache of the browser.
The reason this is necesarry is that clearing any cookies wont force the browser to re-authenticate, it will just use the given credentials and log in again.
If you dont close the browser, sometimes (depending on browser, and browser cache settings) you might experience that you see pages from the previously logged in user.