[BC660K] File read/write/delete issue is seen

I am observing a problem with a file that I open/write/read/close/delete using the Ql_FS_*() functions.

What I am doing is like this (the file is opened/created only if a specific event in the Firmware happens):

1 - open the file via Ql_FS_Open(..., QL_READ_WRITE_CREATE_ALWAYS);
2 - write something to it via Ql_FS_Write()
3 - close the file via Ql_FS_Close()
4 - the firmware reboots for some specific reason that is under our control
5 - open the file via Ql_FS_Open(..., QL_READ_ONLY)
6 - read the file contents via Ql_FS_Read()
7 - close the file via Ql_FS_Close()
8 - delete the file via Ql_FS_Delete()
9 - then the specific event in Firmware happens again, which will trigger the routine to write to file
10 - since the event occurred, then we do the same from step (1), but it will fail to open the file.

I even tried to add a check on the opening by checking if the mode to open is QL_READ_WRITE_CREATE_ALWAYS, which means it does not matter the current status of the to-be-opened file, so I first check if it exists via Ql_FS_Check(), if yes, I delete it via Ql_FS_Delete() and then I execute the normal steps from (1).

But still, the same error occurs, the file opening fails.

Observation: If I flash the module from scratch, it will work fine from Steps 1 to 10, and after that, the problem will happen. The idea is that I should be able to run from Step 1 to 10 any time without seeing an error in opening the file.

Found the cause.

Basically, there was one part of the code that I was missing to close the file, code was returning before the Ql_FS_Close() call.
So, the module rebooted, and because of that, it could not open the file.

That situation should not cause such error, but anyway.
If someone faces the same issue, this is the cause, missing to close the file.