Is there a reason to be doing doing a closing, and then a sequence of erosions, followed by dilations?
Since closing(image, str.elem.) == erode(dilate(image, str.elem), str.elem), it feels like you could better use an erosion (remove noise) followed by a closing (to fill up the empty spaces) instead of the other way around?