fix connection leaking if failed to create new connection