GIMP user closed image are not off loaded from memory

I need a little bit of help!

I have found that GIMP does not always remove closed images from its working memory even if they are not shown.

As you can see here, I have 4 open images, but when I export all of them I actually get 5 JPGs. The extra one was from some earlier image I played with, exported, and saved the XCF just in case I needed it.

It is not my code Since that is more or less directly out of the playbook (see below). Now this is an issue with GIMP, and it explains why I have seen GIMP hugging memory like creasy. You may never see this issue since many people open GIMP work on one to a handful of images and then closes the program. I on the other hand can have GIMP open for weeks so it is ready to run when I need something. I do the same with Word and other programs like the Browser.

Any input is appreciated…

        image_list = gimp.image_list()
        image_ptr = len(image_list)
        for image in image_list:
            fullfilepath = os.path.join(output_folder, filename)
            fullfilepath = clean_string(fullfilepath)
            if (overwrite_index == 1):
                fullfilepath = get_clean_filename(fullfilepath)
            if (fullfilepath != ""):
                raw_filename = filename.encode('utf-8')
                pdb.gimp_file_save(image, image.active_layer, fullfilepath, raw_filename)
                pdb.gimp_image_clean_all(image)