How do I know when client close the window?

Is it possible ? Exists any event onclose?