Fixed app cannot close after cancel confirmation

Reproduce step is:
1. Open app with new document.
2. Type something
3. Close the windows and cancel the confirmation dialog.
4. Do 3. again, dialog does not appear now and cannot close window also