fix memory leak

 (which also fixes crashes from events that were triggered after the message box is destroyed)