To be on the safe side, you can use the TDMS Flush function. If your
application crashes, your machine looses power, or something else kills
the process while your app is running, the OS will close the file and
all data that hasn't been flushed yet is lost. In case your application
terminates due to an error, but doesn't crash or hang (in other words:
the VI stops running with or without having executed TDMS Close), all
open TDMS files will be closed properly with no data loss.
Regards,
Herbert