Fixed infinite loop in task_handler()

TASK_FAIL state doesn't exist any more.  Proper thing is to set task->error and
set state to TASK_COMPLETE.