Suppress expected errors when initiating connections. Add an explicit timeout to initiate connections. Put a lock on closing a connection to prevent data race warnings.