If printf("Not a valid iwd: %s\n", file) gets triggered, then the client gets stuck starting the download of this file and the next ones don't start right?

Could someone suggest a way for the process to go try the next files when this happens please.