job_coorinator: Start the next stage in do_next_stage if there are no outputs.

If there are no outputs, this function is responsible for starting the next
stage.
job_coordinator: remove the unnecessary last_stage_task function.

Other functions have been introduced that do not depend on whether the status of
the finished task has been updated or not.