Added error checking

You know, for those copy-paste types.
Check the return value of save before checking error
More idiomatic error checking
Merge pull request #1 from paulrehkugler/patch-1

Added error checking