Index: src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java (revision 9e5790d00453160d6072f91989e769bd1c87f30f) +++ src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java (date 1604708530365) @@ -1908,10 +1908,15 @@ * @return true if the file was deleted, false if it wasn't. */ boolean dispose() throws IOException { - if (!allFlushed) { - flushRows(); + boolean ret; + try { + if (!allFlushed) { + flushRows(); + } + } finally { + ret = _writer == null || _writer.dispose(); } - return _writer == null || _writer.dispose(); + return ret; } @Override