code: void close(boolean script) {
  
          closeLog();
          deleteNewAndOldFiles();
          writeScript(script);
          closeAllTextCaches(script);
  
          if (cache != null) {
              cache.close(true);
          }
  
          properties.setProperty(HsqlDatabaseProperties.db_version,
                                 HsqlDatabaseProperties.THIS_VERSION);
          properties.setProperty(
              HsqlDatabaseProperties.hsqldb_compatible_version,
              HsqlDatabaseProperties.FIRST_COMPATIBLE_VERSION);
  
          // set this one last to save the props
          properties.setDBModified(HsqlDatabaseProperties.FILES_NEW);
          deleteLog();
  
          if (script) {
              deleteBackup();
              deleteData();
          } else {
              try {
                  backupData();
                  renameNewBackup();
              } catch (IOException e) {}
          }
  
          renameNewScript();
          properties.setProperty(HsqlDatabaseProperties.hsqldb_cache_version,
                                 HsqlDatabaseProperties.THIS_CACHE_VERSION);
          properties.setDBModified(HsqlDatabaseProperties.FILES_NOT_MODIFIED);
      }
docs: Close all the database files. If script argument is true, no .data
  or .backup file will remain and the .script file will contain all the
  data of the cached tables as well as memory tables.
  
  This is not used for filesReadOnly databases which use shutdown.