presto-raptor-legacy/src/main/java/io/prestosql/plugin/raptor/legacy/util/SyncingFileSystem.java/LocalFileOutputStream/close
class LocalFileOutputStream:        @Override
        public void close()
                throws IOException
        {
            if (closed) {
                return;
            }
            closed = true;

            flush();
            out.getFD().sync();
            out.close();

            // extremely paranoid code to detect a broken local file system
            try (InputStream in = new FileInputStream(file)) {
                if (hash.hash() != XxHash64.hash(in)) {
                    throw new IOException("File is corrupt after write");
                }
            }
        }