At this stage I only used a minimally wrapped os.walkDir() for reproducing the problem.
What I really need is os.walkDirRec() which uses os.walkDir() recursively. It works similar to command-line find. As background information I can tell that this an opportunistic forensic search tool I wrote in the past where every data object (eg. ZIP, NTFS, ESE, TAR file) is sort of a directory. In C I had no closures so I fell back to a more driver like architecture not unlike the Posix TLI. Anyway, I believe I found the problem which has nothing to do with the data objects returned by the operator. It looks like the defer mechanism is triggered too early. Maybe there is some caching in the background I am not aware of which holds all the rest of the iterator results already. Then the defer mechanism works correctly. But then again the cache was flushed too early before all values had been yielded.