Fix bug in isolate thread termination.