How did you get dxf file with repeated entity handles? AutoCAD 2018 can't open this dxf, and I have no time to edit it manually. Attach dwg file.
P.S. Without opening file: try to ise _.pedit command at first part of your lines, then repeat this command to another part, and repeat it until you get good enough result.