Synchronizing the pool size check and connection creation (fixes: #10)