Choosing the best approach in Image cleaning(calligraphy) to get rid of noise

Hello everyone, I would like to clean an image and filter it


these imags are made by Arabic calligraphy and then scacnned, and then I made them white and black,
I want to get rid of the extra lines, points, noise etc, complete the missing point, what is the best approach I have applied Opening and Closing like this code as a starting point:

               var src = cv.matFromImageData(jimpSrc.bitmap);
                var dst = new cv.Mat();
                var M = cv.Mat.ones(5, 5, cv.CV_8U);
                var anchor = new cv.Point(-1, -1);
                let newDst = new cv.Mat();
                cv.morphologyEx(src, dst, cv.MORPH_OPEN, M, anchor, 1,
                    cv.BORDER_CONSTANT, cv.morphologyDefaultBorderValue());
                cv.morphologyEx(dst, newDst, cv.MORPH_CLOSE, M);

The Result:
It did’t give me what the result I want, in some pictures it gave me like this

what is the best approach to clean the images without destroying its quality?

Best Wishes,

…and what’s the problem with your result? It seems okay for me.
And what do you want to do with the image? Just print out, or run some kind of OCR?
Note that as this is handwriting, it will never be perfect. There can be breaks in the lines (this is the case even for printed texts), and not all gaps need to be filled.
Anyway, morphology is a good start, you can play with the parameters to get better results.

thanks @kbarni,
well after we get this, it will be converted to svg and sent to a CNC machine. For this reason tolerance varies from a handwriting to another one, some handwritings can accept this gaps or extra dots, and some can’t accept.
Thank you very much