added taskgroup to ensure next is called after all files are written