You can use the window object's onbeforeunload method to catch closures, but the problem is it also picks up on refresh too as it has to unload the page to reload it. Also, AFAIK
there's no way to actually stop a window from closing once the user requests it. You could force the window to reopen but at the risk of losing any form data they may have inputted, but you could store this in cookies (if they have them enabled). There's questions all over google about this, but I've never seen anyone manage it. Surely you run the risk of annoying the crap outta your users though if they can't close their browser?
The name specified is not recognized as an internal or external command, operable program or batch file.