Move zipfile close to after while loop