break out of the ioloop only after the iteration

loop.add_timeout(0, loop.stop) will otherwise interrupt the loop
mid-flight (as opposed to the docstring) and handlers on the sockets
will never be called.

zmq/eventloop/ioloop.py: move the break to the end of the loop
zmq/tests/test_ioloop.py: add test for this