Do you really need this variable and if clause? I think these dialogs are very dependable that you don't need this check since this is only called when the user closes the dialog, so it can never be false