There is one or more programs supposed to be better than regular overkill for purchase around, not sure if that's a solution for you or would even work.
I took a crack at work last week on your sample drawing, nothing worked 100%, it sometimes got an extra line that would have needed to be kept, or didn't delete the strays.
It'll be Wednesday before I get back to work.
I would have thought Overkill would have got those, but like you stated, nothing.
Edit:
Maybe something like this? This creates regions of the closed areas also makes a region of the entire selection, then deletes all but the regions. You could explode the regions after if you like.
;;; Removes everything after making closed areas regions
;;;
;;; https://www.cadtutor.net/forum/topic/97915-duplicated-lwpolylines/#findComment-671251
;;;
;;; SLW210 (a.k.a. Steve Wilson)
;;;
(defun c:ReSt ( / ss acadDoc ms allEnts ent i loopEnts reg regList sa)
(vl-load-com)
(setq acadDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq ms (vla-get-ModelSpace acadDoc))
;; Select all LINE, ARC, LWPOLYLINE, CIRCLE
(setq ss (ssget "X" '((0 . "LINE,ARC,LWPOLYLINE,CIRCLE"))))
(if (not ss)
(progn
(prompt "\nNo entities found.")
(exit)
)
)
;; Collect all VLA objects.
(setq allEnts '())
(repeat (sslength ss)
(setq ent (vlax-ename->vla-object (ssname ss 0)))
(setq allEnts (cons ent allEnts))
(ssdel (ssname ss 0) ss) ; Remove from selection set
)
;; Create REGIONS from geometry.
(setq sa (vlax-make-safearray vlax-vbObject (cons 0 (1- (length allEnts)))))
(setq i 0)
(foreach ent allEnts
(vlax-safearray-put-element sa i ent)
(setq i (1+ i))
)
;; Create regions
(setq regList (vl-catch-all-apply
'vla-AddRegion
(list ms sa)))
(if (vl-catch-all-error-p regList)
(prompt "\nFailed to create regions. Check for gaps or open loops.")
(progn
;; Delete original entitie if region creation succeeded.
(foreach ent allEnts
(if (not (vlax-erased-p ent)) (vla-delete ent))
)
(prompt "\n Regions created and original objects deleted.")
)
)
(princ)
)