Ensure PQfinish is called when connection fails