The obvious thing you're missing is that windows never close.
That's because they don't exist.
When a request is made for a page, a thread starts, generates the page, and then disappears. The page is displayed in the browser, but there is nothing on the server side that matches that "page". the user might navigate elsewhere, they might turn off their PC - anthing might happen. But the page never "closes".
So what is your real question? What are you wanting to do, when, and why?
cheers
Bruce