If you set game.speed == 0 the game stops ( obviously ), but also the whole application stop working.
So I can not do anything to change the speed again or close the game in a normal way, I have to use the task manager to close factorio.
There should be at least an "emergency exit" that let you return to main menu.