Fixing encoder crash on too many open files