@Override
    public void close() {
        if (!closed) {
            closed = true;

            try {
                outputStreamWrapper.close();
                outputStreamWrapper.cleanup();
            } catch (Throwable t) {
                LOG.warn("Could not close the state stream for {}.", metadataFilePath, t);
            }
        }
    }
@TestTemplate
    void testCleanupWhenClosed() throws Exception {
        Path metaDataFilePath = baseFolder();
        FsCheckpointMetadataOutputStream stream = createTestStream(metaDataFilePath, fileSystem);
        stream.close();
        assertThat(fileSystem.exists(metaDataFilePath)).isFalse();
    }