Added checks for the progress dialog when the activity is paused.