Remove event listeners on tab close