<p>I am writing my own slicer and wonder if there is a mathematical proof that proves that the intersection of the slicing plane with the STL file will only produce closed-loop polygons for every given slicing plane?</p>

<p>Thanks!</p>

You can't prove that because it isn't true. An STL file is just a collection of triangles. There is no guarantee that an intersection with the slicing plane will consist of closed-loop polygons. To be suitable for 3D printing an STL file should represent one or more closed, disjoint polyhedra (which would yield closed-loop polygons) but this is not always the case. Many slicers have heuristics to try and "fix" bad STL files on a best-effort basis. Especially considering the possibility of rounding errors, it is important to at least detect polygons that are almost (but not quite) closed and connect their endpoints together.