Fix memory leaks -- destroy most dialogs on "deactivate"