code: @Override
      public void flush() throws IOException {
          checkClosed();
          
          if (bs.isDirty()) {
              bs.write();
          }
          
          for (int i = 0; i < bs.getNrFats(); i++) {
              fat.writeCopy(bs.getFatOffset(i));
          }
          
          rootDir.flush();
          
          if (fsiSector != null) {
              fsiSector.setFreeClusterCount(fat.getFreeClusterCount());
              fsiSector.setLastAllocatedCluster(fat.getLastAllocatedCluster());
              fsiSector.write();
          }
      }
docs: Flush all changed structures to the device.
  
  @throws IOException on write error