tidy up error handling for re-entrant Close() and Join() calls to Socket and Thread