Originally Posted by pan64
I think your for cycle does not work, it is simple not possible (to close a file descriptor from outside, from another process - for example from a shell script).
There is in theory another way to do this, though I would have to dig though my notes on how to remove the flag of open files by PID. However if anything did go wrong your looking at a corrupt file table on your format. I think it might be better to trace the PID of the offending process and kill it. Barking up any other tree might just trash your entire disk.