fix for race condition in issue #135

If we are publishing in a tight loop, the ack/error events may not be emitted in time to clear out the error event.