(You don't need the "delete" if you subsequently open as "create/replace". Just wire the "advisory dialog" with a "false" to avoid the dialog, delete is implicit.)
I think your problem is due to how you "close" the file in "T38 Write Init Datalog.vi". Basically, you "open" in once more, then close that second instance, meaning the "open" in the upper left still holds onto the file, preventing deletion. Remove the second "open" and close the file with the original refnum (see attached example).
There is a second problem, though: Can you explain why the main program contains a while loop? If the boolean is false, you'll continually try to delete the file again while it never gets closed, giving you the same error from the second iteration on. You don't reall
y want to delete/open/"write the SAME data" over and over again as fast as the computer allows, right?