Add TypeError handling to _check_rc function.

On some occasions at the end of a process, the
importation of zmq.error classes is impossible.
This is yet fully known why it happens, but it
is probably related to the garbage collector.
This patch avoids TypeError by catching them if
they happen on error importation, and simply
return 0 since this means that the process has
ended anyway.