Scoob
I think that was a red-herring...
The error is occurring because it's trying to find an extension of an image-file ['fileExtname'] when it's exporting a texture.
The crash with the 'out of range thing' is because it's not finding a file-path for the texture image that has an extension on it ??
I can trap for this... BUT if a material has a texture then that texture's original image file-name is always either represented by a full-path or a file-name - with type suffix... There should never be a texture without a file-path/name associated with it...
See this example
You said you had a texture image that didn't appear in the folder -that looks like the one making the problem - edit that - and see if it has a file-name properly set - if so then it's weird.
If the file-name/path has accented-characters etc in it then that might cause a glitch - if so try editing the image, save_as without them and reusing that - retry...
You might check all textured materials image file-names if it keeps happening
I can probably allow for that in an update...
If 'not' then try editing the image and resetting it [you need to specify an image-editor app in your preferences beforehand [I use Gimp]] - TIP: the edited image is put into C:/Users/Scoob/AppData/Local/Temp/ - sort by date an it should appear near the top of the list as say 'Brick_Antique.jpg'
Incidentally have you used 'Model Info' > 'Fix Problems...'