Add exception logging for wait_for_files.