As a quick test, comment out the line that actually runs the script: (command ..... )
Then try running the lisp again. If it now deletes the file, then I would have to assume that the script is still running when you are trying to delete it. Try adding a (while (> (getvar "cmdactive") 0), or something to wait for the script to finish.