statemachine.save: pass fileoutputstream instead of outputstream

to let the application call fsync on it.