For details see https://www.klayout.de/forum/discussion/1332/drawing-a-polygon-not-getting-it-about-ending-malformed#latest