diff --git a/server/src/main/java/com/defold/extender/ExtenderController.java b/server/src/main/java/com/defold/extender/ExtenderController.java index 9b194403..2c00d4b5 100644 --- a/server/src/main/java/com/defold/extender/ExtenderController.java +++ b/server/src/main/java/com/defold/extender/ExtenderController.java @@ -100,11 +100,13 @@ public void buildEngine(MultipartHttpServletRequest request, Extender extender = new Extender(platform, uploadDirectory, sdk, buildDirectory); - // Build and write output files to output stream - List outputFiles = extender.build(); - ZipUtils.zip(response.getOutputStream(), outputFiles); - - extender.dispose(); + try { + // Build and write output files to output stream + List outputFiles = extender.build(); + ZipUtils.zip(response.getOutputStream(), outputFiles); + } finally { + extender.dispose(); + } } finally { // Delete temporary upload directory FileUtils.deleteDirectory(uploadDirectory);