change to window unload event.