diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/ImportsLoader.java b/src/main/java/org/openecomp/sdc/toscaparser/api/ImportsLoader.java
index 6794f9a..1fac3f1 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/ImportsLoader.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/ImportsLoader.java
@@ -246,9 +246,8 @@
         }
 
         if(UrlUtils.validateUrl(fileName)) {
-        	try {
-	            al[0] = fileName;
-        		InputStream input = new URL(fileName).openStream();
+			try (InputStream input = new URL(fileName).openStream();) {
+				al[0] = fileName;
 				Yaml yaml = new Yaml();
 				al[1] = yaml.load(input);
 	            return al;
@@ -354,9 +353,9 @@
     	        al[0] = al[1] = null;
     	        return al;
             }
-            try {
+            try (InputStream input = new FileInputStream(new File(importTemplate));) {
 	            al[0] = importTemplate;
-				InputStream input = new FileInputStream(new File(importTemplate));
+
 				Yaml yaml = new Yaml();
 				al[1] = yaml.load(input);
 	            return al;
@@ -417,9 +416,8 @@
         	}
         }
         if(UrlUtils.validateUrl(fullUrl)) {
-        	try {
-	            al[0] = fullUrl;
-        		InputStream input = new URL(fullUrl).openStream();
+			try (InputStream input = new URL(fullUrl).openStream();) {
+				al[0] = fullUrl;
 				Yaml yaml = new Yaml();
 				al[1] = yaml.load(input);
 	            return al;
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java b/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
index 4c6ba3a..d4506e1 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
@@ -144,10 +144,9 @@
 			path = _getPath(_path);
 			// load the YAML template
 			if (path != null && !path.isEmpty()) {
-				try {
+				try (InputStream input = new FileInputStream(new File(path));){
 					//System.out.println("Loading YAML file " + path);
 					log.debug("ToscaTemplate Loading YAMEL file {}", path);
-					InputStream input = new FileInputStream(new File(path));
 					Yaml yaml = new Yaml();
 					Object data = yaml.load(input);
 					this.tpl = (LinkedHashMap<String,Object>) data;
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/prereq/CSAR.java b/src/main/java/org/openecomp/sdc/toscaparser/api/prereq/CSAR.java
index ef29b53..b40eded 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/prereq/CSAR.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/prereq/CSAR.java
@@ -273,8 +273,7 @@
 	public LinkedHashMap<String,Object> getMainTemplateYaml() throws JToscaException {
     	String mainTemplate = tempDir + File.separator + getMainTemplate();
     	if(mainTemplate != null) {
-			try {
-	    		InputStream input = new FileInputStream(new File(mainTemplate));
+			try (InputStream input = new FileInputStream(new File(mainTemplate));){
 				Yaml yaml = new Yaml();
 				Object data = yaml.load(input);
 		        if(!(data instanceof LinkedHashMap)) {
@@ -459,34 +458,35 @@
         if (!destDir.exists()) {
             destDir.mkdir();
         }
-        ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));
-        ZipEntry entry = zipIn.getNextEntry();
-        // iterates over entries in the zip file
-        while (entry != null) {
-        	// create all directories needed for nested items
-        	String[] parts = entry.getName().split("/");
-        	String s = destDirectory + File.separator ;
-        	for(int i=0; i< parts.length-1; i++) {
-        		s += parts[i];
-        		File idir = new File(s);
-        		if(!idir.exists()) {
-        			idir.mkdir();
-        		}
-        		s += File.separator;
-        	}
-            String filePath = destDirectory + File.separator + entry.getName();
-            if (!entry.isDirectory()) {
-                // if the entry is a file, extracts it
-                extractFile(zipIn, filePath);
-            } else {
-                // if the entry is a directory, make the directory
-                File dir = new File(filePath);
-                dir.mkdir();
-            }
-            zipIn.closeEntry();
-            entry = zipIn.getNextEntry();
-        }
-        zipIn.close();
+
+        try (ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));){
+			ZipEntry entry = zipIn.getNextEntry();
+			// iterates over entries in the zip file
+			while (entry != null) {
+				// create all directories needed for nested items
+				String[] parts = entry.getName().split("/");
+				String s = destDirectory + File.separator ;
+				for(int i=0; i< parts.length-1; i++) {
+					s += parts[i];
+					File idir = new File(s);
+					if(!idir.exists()) {
+						idir.mkdir();
+					}
+					s += File.separator;
+				}
+				String filePath = destDirectory + File.separator + entry.getName();
+				if (!entry.isDirectory()) {
+					// if the entry is a file, extracts it
+					extractFile(zipIn, filePath);
+				} else {
+					// if the entry is a directory, make the directory
+					File dir = new File(filePath);
+					dir.mkdir();
+				}
+				zipIn.closeEntry();
+				entry = zipIn.getNextEntry();
+			}
+		}
     }
     
     /**
@@ -499,14 +499,14 @@
     
     private void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
         //BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
-    	FileOutputStream fos = new FileOutputStream(filePath);
-    	BufferedOutputStream bos = new BufferedOutputStream(fos);
-        byte[] bytesIn = new byte[BUFFER_SIZE];
-        int read = 0;
-        while ((read = zipIn.read(bytesIn)) != -1) {
-            bos.write(bytesIn, 0, read);
-        }
-        bos.close();
+		try (FileOutputStream fos = new FileOutputStream(filePath);
+			 BufferedOutputStream bos = new BufferedOutputStream(fos);){
+			byte[] bytesIn = new byte[BUFFER_SIZE];
+			int read = 0;
+			while ((read = zipIn.read(bytesIn)) != -1) {
+				bos.write(bytesIn, 0, read);
+			}
+		}
     }
 
 }	
