major rewrite of zipfile writing

With this last commit, I've completely redone zipfile writing. Basically nothing is written until close() or writetodisk() are called. Careful study of the old code showed that everything was being written twice anyway, so this should make writing twice as fast and half as bogus.

Test coverage is less than complete of course, so accept with caution.

We have had problems with closing packages that have been added to; writing seemed to mess with reading the file headers. So we sort of had to fix this; hope nothing else was broken along the way.

We also had problems with unicode in added files; that fix was cmparatively easy.

If you expect infolist() or namelist() or other zipfile methods to be meaningful at all in intermediate states, or if you call _safeclose() directly, that could be a problem, but otherwise things should continue to work the way you expect. also, the mode property won't reflect the calling mode- that's in the new epub_mode property.