publish event when page has page problems

Nevermind! I just subscribed to the ‘beforeunload’ event and it runs the function to save when someone closes the page. 

Thanks again!