This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I can think of a couple of ways you might accomplish this:
1.Automatically refresh the page every minute or so, and have it check for the existence of a session each time it refreshes. If none exists, close the window.
2.The same as number 1, except that you make an AJAX call to the server checking for a session instead of refreshing the page.