Make State{Model,MachineWatcher} more robust

In fact we're now at a point where remote-debugging QSMs actually works
again properly, without crashing at exit, etc.