Write to disk in batches of 100