GDSII's basic geometric entity is the boundary. This consists of a closed figure with a minimum of three sides and a maximum of approximately 8196 sides. (The max is based on record size limitations; the original GDSII spec only allowed 200 vertices per boundary but that limit has long been ignored by modern layout tools.)
Designers using AutoCAD and other mechanical CAD software are free to use lines and arcs. These are independent geometries and even if their end points meet, they are not "grouped" in a way that clearly defines the inside or outside of a closed region.
So a very useful function is the ability to collect all the lines and arcs on a given layer, connect them together at the end points and output boundaries in GDSII.
Not every designer uses a "snapping" function to insure that the ends of the lines and arcs exactly touch. Often there is a small (sometimes almost invisble) gap between end points. So the linker can be assigned a search radius that will allow it to make connections even for end points that are not perfectly aligned.
The linking algorithm can only do so much. Many incoming CAD files are so poorly drawn that the user's intent cannot be determined and boundaries can't be formed from all the available lines and arcs. In this case the resulting GDSII output is split into two layers - one layer will hold all the boundaries that could be formed. The other will hold all the leftover lines and arcs that did not form boundaries.
Examining the so called "error layer" can give a draftsman some very good hints where problems such as lines under lines and missing lines -- which are not easily visible on screen -- are interfering with the successful conversion of lines/arcs into closed regions.
A short video showing how the linking (and error reporting) works. We'll convert a leadframe drawn using lines and arcs into a GDSII file with closed boundaries.