If I understand correctly, you want to know how to detect the client user action of closing a browser window in your code behind.
There is no event directly by which you can detect this. I have wished there was, too :(.
About the closest thing you may find is
here!