class GBPTree implements Closeable {

    @Override
    public void close() throws IOException
    {
        if ( readOnly )
        {
            // Close without forcing state
            doClose();
            return;
        }
        lock.writerLock();
        try
        {
            if ( closed )
            {
                return;
            }

            maybeForceCleanState();
            doClose();
        }
        catch ( IOException ioe )
        {
            try
            {
                pagedFile.flushAndForce();
                maybeForceCleanState();
                doClose();
            }
            catch ( IOException e )
            {
                ioe.addSuppressed( e );
                throw ioe;
            }
        }
        finally
        {
            lock.writerUnlock();
        }
    }

    public  GBPTree( PageCache pageCache, File indexFile, Layout<KEY,VALUE> layout, int tentativePageSize,
            Monitor monitor, Header.Reader headerReader, Consumer<PageCursor> headerWriter,
            RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, boolean readOnly );

}