Closed the pgclients after returning query