some cleanup in -zip-*-file: check return values of reading/writing, move buffer off the stack, stop using 1024-flavored units and simplify logic