[TIMOB-13184] Updated getUnprocessedFiles to be more robust