Index: trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 19369)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 19372)
@@ -23,4 +23,5 @@
 import java.util.function.Predicate;
 import java.util.stream.Stream;
+import java.util.zip.ZipFile;
 
 import org.openstreetmap.josm.data.osm.IPrimitive;
@@ -289,15 +290,19 @@
         CheckParameterUtil.ensureParameterNotNull(url, "url");
         ParseResult result;
-        try (CachedFile cache = new CachedFile(url);
-             InputStream zip = cache.findZipEntryInputStream("validator.mapcss", "");
-             InputStream s = zip != null ? zip : cache.getInputStream();
+        try (CachedFile cache = new CachedFile(url)) {
+             Pair <ZipFile, InputStream> zip = cache.findZipEntryInputStream("validator.mapcss", "");
+             try (InputStream s = zip != null ? zip.b : cache.getInputStream();
              Reader reader = new BufferedReader(UTFInputStreamReader.create(s))) {
-            if (zip != null)
-                I18n.addTexts(cache.getFile());
-            result = MapCSSTagCheckerRule.readMapCSS(reader, assertionConsumer);
-            checks.remove(url);
-            checks.putAll(url, result.parseChecks);
-            urlTitles.put(url, findURLTitle(url));
-            indexData = null;
+                if (zip != null)
+                    I18n.addTexts(cache.getFile());
+                result = MapCSSTagCheckerRule.readMapCSS(reader, assertionConsumer);
+                checks.remove(url);
+                checks.putAll(url, result.parseChecks);
+                urlTitles.put(url, findURLTitle(url));
+                indexData = null;
+            } finally {
+                if (zip != null)
+                    Utils.close(zip.a);
+            }
         }
         return result;
Index: trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java	(revision 19369)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java	(revision 19372)
@@ -21,4 +21,5 @@
 import java.util.Map;
 import java.util.Set;
+import java.util.zip.ZipFile;
 
 import javax.swing.JOptionPane;
@@ -48,4 +49,5 @@
 import org.openstreetmap.josm.tools.I18n;
 import org.openstreetmap.josm.tools.Logging;
+import org.openstreetmap.josm.tools.Pair;
 import org.openstreetmap.josm.tools.Stopwatch;
 import org.openstreetmap.josm.tools.Utils;
@@ -376,11 +378,16 @@
             CachedFile cf = new CachedFile(source).setHttpAccept(PRESET_MIME_TYPES);
             // zip may be null, but Java 7 allows it: https://blogs.oracle.com/darcy/entry/project_coin_null_try_with
-            InputStream zip = cf.findZipEntryInputStream("xml", "preset")
         ) {
+            Pair <ZipFile, InputStream> zip = cf.findZipEntryInputStream("xml", "preset");
             if (zip != null) {
-                zipIcons = cf.getFile();
-                I18n.addTexts(zipIcons);
-            }
-            try (InputStreamReader r = UTFInputStreamReader.create(zip == null ? cf.getInputStream() : zip)) {
+                try {
+                    zipIcons = cf.getFile();
+                    I18n.addTexts(zipIcons);
+                } finally {
+                    Utils.close(zip.b);
+                    Utils.close(zip.a);
+                }
+            }
+            try (InputStreamReader r = UTFInputStreamReader.create(zip == null ? cf.getInputStream() : zip.b)) {
                 tp = readAll(new BufferedReader(r), validate, all);
             }
Index: trunk/src/org/openstreetmap/josm/io/CachedFile.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 19369)
+++ trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 19372)
@@ -316,6 +316,8 @@
      */
     public String findZipEntryPath(String extension, String namepart) {
-        Pair<String, InputStream> ze = findZipEntryImpl(extension, namepart);
+        Pair<String, Pair<ZipFile, InputStream>> ze = findZipEntryImpl(extension, namepart);
         if (ze == null) return null;
+        Utils.close(ze.b.b);
+        Utils.close(ze.b.a);
         return ze.a;
     }
@@ -328,13 +330,14 @@
      * doesn't represent a zip file or if there was no matching
      * file in the ZIP file.
-     * @since 6148
-     */
-    public InputStream findZipEntryInputStream(String extension, String namepart) {
-        Pair<String, InputStream> ze = findZipEntryImpl(extension, namepart);
+     * The returned ZipFile must be closed after use.
+     * @since 19372
+     */
+    public Pair<ZipFile, InputStream> findZipEntryInputStream(String extension, String namepart) {
+        Pair<String, Pair<ZipFile, InputStream>> ze = findZipEntryImpl(extension, namepart);
         if (ze == null) return null;
         return ze.b;
     }
 
-    private Pair<String, InputStream> findZipEntryImpl(String extension, String namepart) {
+    private Pair<String, Pair<ZipFile, InputStream>> findZipEntryImpl(String extension, String namepart) {
         File file = null;
         try {
@@ -345,7 +348,7 @@
         if (file == null)
             return null;
-        Pair<String, InputStream> res = null;
+        Pair<String, Pair <ZipFile, InputStream>> res = null;
         try {
-            ZipFile zipFile = new ZipFile(file, StandardCharsets.UTF_8); // NOPMD
+            ZipFile zipFile = new ZipFile(file, StandardCharsets.UTF_8);
             ZipEntry resentry = null;
             Enumeration<? extends ZipEntry> entries = zipFile.entries();
@@ -358,6 +361,6 @@
             }
             if (resentry != null) {
-                InputStream is = zipFile.getInputStream(resentry); // NOPMD
-                res = Pair.create(resentry.getName(), is);
+                InputStream is = zipFile.getInputStream(resentry);
+                res = Pair.create(resentry.getName(), Pair.create(zipFile, is));
             } else {
                 Utils.close(zipFile);
