add window close event listener, ultimately for manipulating firebase