Refactored the code that closes the active dialogs