Fix some errors in UndoCommand and StateManager. StateManager's update() method changed so that it doesn't return in the middle of the function. It should only return after writeToFile() is called.