Check for isFinishing when creating dialogs from background tasks