Fix unit test failure caused by the order of Done and Terminated message