Close dialogs before opening dialogs. Ensures "hide" event comes before "show".