* Close sockets and streams to fix ResourceWarning warnings * Catch also OSError to hide a traceback on an expected handshake error