As others have mentioned, there's unfortunately not a straightforward and portable way to find out if a file is still open. Here are some pragmatic possibilities (in other words, some hacks).
If you have control over the applications generating the data, you can modify them to use locking, and then use locking to find out if the files are still in use.
If you can't change the applications but do control how they're started, you could wrap them in a script that did some kind of locking, or have them write to a temporary file then move it into place when it's done.
If the applications write to the files fairly often as they're running, you can see if the file was modified recently, and if so assume that it might still be open and skip it; appropriate values of recently will vary by application.