code: void closeAllPaths(int geometry) {
  		if (getGeometryType(geometry) == Geometry.GeometryType.Polygon)
  			return;
  		if (!Geometry.isLinear(getGeometryType(geometry)))
  			throw GeometryException.GeometryInternalError();
  
  		for (int path = getFirstPath(geometry); path != -1; path = getNextPath(path)) {
  			setClosedPath(path, true);
  		}
  	}
docs: Closes all paths of the geometry (has to be a polyline or polygon).