After writing all rows, you must call flushRows() to ensure that all buffered row data is committed to the file.