Improved the error handling in the face of adversity and removed the implicit closing - not our responsibility - it is the callers.
Merge pull request #18 from huntc/improved-error-handling

Improved error handling