Called when thread is going to stop.
Useful for cleanup of things created on thread start.
a ThreadedObject