"Close gap" in Fill tool

I have created a script here that makes it easy to make a selection with a closed gap, if you are interested in trying it out. You can run it from Scripter. My code may not be something that can be implemented in Krita itself, but I think it could be useful on a limited basis.