If the polyline's start point and end point are not at the same point, set Closed=true would extent the polyline from the previous end point to the start point. So, the polyline would ends up with the same count of vertices and segment (between vertices). In this case, we say the polygon from the polyline does not have duplicated vertices. This is the correct closed polyline equivalent to GIS polygon in AutoCAD.
In your code case, it is obviously the polyline's start point and end point are at the same location. Closed=true simply make the polyline closed (i.e. adding a segment with 0 length between start and end point. It is your responsibility as programmer, who wants to create a closed polyline as polylgon, to decide if duplicate vertices are allowed or not; and if not, you need to remove it. If you have used AutoCAD Map, you know it comes drawing clean up tool with one of the features is to remove duplicated vertices from closed polyline.
This kind of closed polylines with start/end points are at the same position very often are the result of importing GIS polygon, where the importing process does not correctly convert GID polygon into AutoCAD's closed polyline, because in GIS worked, the closed polyline loop (polylone) is expressed with series of points with the first point and the last point being the same.
So, in AutoCAD, there is not CORRECT or INCORRECT way to close a polyline. It is your code's resposibility to set Closed=True/False, and detect/deal with duplicated vertices when necessary.