Stop thread before dispatcher deletion

Dispatcher thread needs to be stopped before the dispatcher is deleted.