Avoid adding elements to QueueingThread if it's stopped. (#596)