code: private static void closeDB(PersistenceManager pm) {
          if (pm.currentTransaction().isActive()) {
              pm.currentTransaction().rollback();
          }
          pm.close();
          pm.getPersistenceManagerFactory().close();
      }
docs: Close the database connection.
  
  @param pm The current PersistenceManager.