Modify wait_for_file test to check for PENDING job
Fix race condition in a test