Solution is too much complicated and involves commands like `Common.closeApplication()` whose only intention is to provide a testable wrapper for `window.close()` in the same way `Common.modelAlert()` does so, if you don't mind, I prefer just re-checking the state here, just after the modal alert and avoid closing if we can continue.