Fix dialog dismiss when is not added to the activity