You could also use another WHILE loop checking the file existence as part of the del, or use a SHELL which "should" wait till completed.