Write out the mmap-ed data in small chunks to avoid locking the output file for a long time. Suggested by David Holland on "source-changes-d" mailing list.