fix multiple callbacks when socket errors occur

Realized there might be a case where the socket errors on a write,
and then there are multiple write calls. Each write will emit an
error, causing multiple callbacks for things like publish
Merge pull request #30 from segmentio/fix/multiple-callback

fix multiple callbacks when socket errors occur