fix timeout race condition in stop()

With high connect timeout (20s+) there is a strong chance that
_safe_close() will timeout waiting for the connect loop select()
statement to timeout (after 2/3 of the connect timeout).