implement waiting for a file to appear