Making dialogs close on click