refactor the exit of nvda and gui.terminate (#12342)
Summary of the issue:
Changes introduced in #12183
- caused the braille viewer to be closed without saving state properly
- lost code that destroyed the system tray and menu in some instances
- made most of gui.terminate no longer necessary/redundant
Description of how this pull request fixes the issue:
- Creates `core.triggerNVDAExit` which terminates necessary modules safely and then closes all windows
- Destroys the system tray icon and menu
- Uses a parser error message if a new NVDA instance fails to end a running instance.
- Uses an enum for ChangeWindowMessageFilter filters.
Known issues with pull request:
WM_QUIT will not exit the app safely (called from a new NVDA instance) when a dialog such as WelcomeDialog is still open