Fix tmpfile cleanup for windows (itertools not supported), Fix #6209

Rather than continue the list comprehensions that have given trouble
previously, I just did it with an easy-to-follow nested loop.
Merge pull request #6216 from basepi/tmpfiles6209

Fix tmpfile cleanup for windows (itertools not supported), Fix #6209