How does create closed surface representation work ?

Actually this has been discussed various times on the forum. Unfortunately the search function is extremely bad. Maybe try a bit more, but here’s a basic answer:

The conversion is part of a multi-representation mechanism, which is described in this paper and thesis:
Manuscript of the paper
Thesis
The actual algorithm changed a bit in the sense that an alternative filter, the relatively new surface nets method has been added. But the default algorithm is the same as what is described in these sources.

You say you couldn’t find the code, so I assume that would help as well: