fixed not calling next at right time in writeAfter during generate
added taskgroup to ensure next is called after all files are written