Are you using FileX with LevelX. if yes, Filex is designed to maintain file system integrity if the media loses power or is ejected in the middle of a file write operation.
More information on FileX Fault tolerant feature can be found here
https://learn.microsoft.com/en-us/azure/rtos/filex/chapter6#:~:text=Chapter%206%20%2D%20Azure%20RTOS%20FileX%20fault%20tolerant%20module