Fix race when getting the connection pool

Multiple threads could create identical connection pools.