Terminate the multithreaded test when the optimal solution is reached.