Fix invalid iterator comparison in process_canceled_tasks when canceling the only task in task_sch_queue