why not use kix's built in del command?

del "<filename>"

if the file was in use @error will be able to tell you. Either way the script will not stop running if the file is in use.

Bryce