LIBZMQ-497 there could be unsent bytes in encoder

When we send a large message, the message can be splitted into two chunks.
One is in the encoder buffer and the other is the zero-copy pointer.
The session could get the term before the last chunk is sent.
Merge pull request #76 from hintjens/master

Backported fix for LIBZMQ-497