Currently temporary files are added to Framework#trackFile and the files are deleted when the GC removes the related object from the JVM.
With this method, sometimes files or folders are never removed.
One solution could be to remove these temp files at the end of the thread execution.
Attached is a small POC