Don't crash on window rotation when tasks finish.

This doesn't address the underlying problem of handling rotation
improperly when there's an outstanding task; we now leak the progress
dialogs. But at least the crash is fixed.