Do not push undefined connections back into the pool

If the connection fails because of a server error, the code pushes an undefined connection back into the pool.