Updated FileIo to write all of the tasks in the right order into the file