Fix issue of stale dialog when using "Next" menu item in system tray
Fix issue of invalid state transition caused by previous bug fix