You have not been able to perform this action for a long time now in browsers since they have pop up blockers installed. Plus there is no way to really tell if the user closed the window with the X. There is some x/ positioing hack in some browsers, but that is a limited number . Plus there are other ways to close the window other than the X. Best bet is to use onbeforeunload and code the application to understand the difference between a postback and closing the browser through some boolean flags.
Eric
Coauthor of Ajax In Action [#1 Computer and Internet book on Amazon for 2006]
If you get an answer to your question, please mark it solved so people don't waste time reading already answered questions!