Should also close the thread.