Close connection if no valid result found.