add the task mutex in terminate()