Fix a race (to crash) when a message is sent as the last connection is lost.

Active is reduced in the zmq internal thread in terminated, potentially to zero.
If the user thread is in send() between lines 109 and 116, then the old code "(current+1) % active" is a divide by 0 - and crashes the program.
Merge pull request #116 from daveab/master

Fix race to crash: when a message is sent as the last connection is lost

Fixes #1002