Allow to quit application anytime by closing the application window (#10921)