Close the editor before leaving the page