Handle ProgressDialog's cancellation properly.