I studied the ‘bad file descriptor’ problem and I have found a solution.
If I am right the bug is too embarrassing to show. It’s one of these things you can’t see until you see it.
The funny thing is that it was included from the beginning of the inept scripts and specific problems haven not been reported before. Maybe the bigger size of the script has shown the problem.
Anyway, I strongly recommend to test this update (if you had the file descriptor problem) and report back as soon as possible.