public void close() {
        Utils.closeQuietly(loader, "loader");
        if (raftManager != null) {
            try {
                raftManager.shutdown();
            } catch (Exception e) {
                log.error("Error shutting down RaftManager", e);
            }
        }
        Utils.closeQuietly(snapshotFileReader, "raftManager");
        if (fileLock != null) {
            try {
                fileLock.destroy();
            } catch (Exception e) {
                log.error("Error destroying fileLock", e);
            } finally {
                fileLock = null;
            }
        }
    }
Take the FileLock in the given directory.
shell/src/main/java/org/apache/kafka/shell/MetadataShell.java