only write to the file when we have ALL the ids