saveToFile return on error

pulled from @jorin-vogel
Merge branch 'jorin-vogel-master'

* jorin-vogel-master:
  saveToFile return on error