Fixed the exit of the worker thread.
Cleanup.