Can't cap brep

hi,
I have some polylines that draw between wave shape points. when I combine the lines and extrude them I got an open extrude. when Im trying to cap the brep I got a wrong message.
attached gh code.

lib2.gh (39.9 KB)

your lines are not planar, try and use patch instead