update canceled state when a task is canceled and cancel a task only if it is not in a complete state