Also: - Use context managers for file opening/closing in tests - Changed use of deprecated `BadZipfile` exception - Removed debugging code left by mistake