Fix bug in worker clean-up in UI

Introduced in d5a96fec. This should be picked into 0.8 and 0.9 as well.