Clean up stats thread on termination.