Remove event handlers on shutdown