fix: wait for queued tasks to end at worker termination