Remove event handlers after the component has been destroyed to prevent memory leaks.