taskrunner: Fix dequeueing/requeuing of active tasks when complete