Clean up close event handling for modal dialogs.  Remove the stopPropagation hack, add a better hack to set the close handler in a setTimeout.