Fix haagent test leaking policy thread loop