Release event handler to fix memory leak