I was wandering how do i do a alert on a close window?

and i mean close a window an not just unLoaded