There is no such event.
The alert you get when closing a page which has not been opened by JavaScript does not return anything, (it's not scriptable since it's a security measure) so it's not possible to know which button was pressed.
You could make the client poll your server every minute or so to tell the server it's still there. Kinda like what Gmail does when it asks the server for new mail using httpRequest.
But that would generate extra traffic, and you'd still need a timeout of some sort. And scripting might be disabled on the client, fooling your server into thinkin that the client has already closed the window...
And so on...