Added a missing ending thread.