Handle errors from writeBuffer calls.
Merge pull request #1 from drob/callback

Handle errors from writeBuffer calls.