Hi,
You'd rather use the bitwise AND operator ("&") to test for the 70 group flag (a closed (lw)polyline may also have flag 128).
For POLYLINE entities, you have to avoid (old style) meshes which are polylines too (flags 16, 32 and 64).
(ssget '((-4 . "<OR")
(-4 . "<AND")
(0 . "LWPOLYLINE")
(-4 . "&")
(70 . 1)
(-4 . "AND>")
(-4 . "<AND")
(0 . "POLYLINE")
(-4 . "&")
(70 . 1)
(-4 . "<NOT")
(-4 . "&")
(70 . 112)
(-4 . "NOT>")
(-4 . "AND>")
(-4 . "OR>")
)
)