Dynamo is open source but the geometry kernel behind it is not
Edit: Nurbs surfaces by definition can not be closed because they have to be parametricised ([0:1] in both u and v). They can only appear closed. I think the only exception to that is periodic surfaces but I’m not sure if those are supported.