If the activity is being finished, don't dismiss the dialog. This is already handled in the closeDialogs() function.