Hi,
This is not a Professional solution !.
You know that if a file is already opened, it could not be deleted. So you can copy the file to a temporary one and try deleting the original file , if the delete operation failed, this mean that the file is used by another app. , if delete success...