Whilst working on #17796 I noticed that we don't fail operations when the JarFile has been closed. The JDK has an ensureOpen method in ZipFile that we should mimic.