I agree, move the writeToFileNamed outside the loop.
Instead of adding each file to 1 zip, you are doing something like the following:
- Zip up file 1
- Zip up file 1 and 2
- Zip up file 1, 2, and 3
- Zip up file 1, 2, 3, and 4
You should add all the files, then
writeToFileNamed at the end.