Added two-step termination of the TCP connector workers.

This removes a race condition causing some of the clients to crash ocasionally.
Merge pull request #45 from brainly/tcp-fixes

Refactors TCP Connector's worker termination logic.