Exit a search loop when the search goal is found.