Unexpected Reset after Writing OTP Header

The current device is DA14585 running SDK 6.0.14.

I'm using a code in order to write some words to the otp header using the  "hw_otpc_fifo_prog" function. I also tried the other functions to write to the otp header "hw_otpc_dma_prog" and "hw_otpc_manual_prog".

The code is working, meaning that it actually writes the desired words in the otp header. The problem is that when I put the device in any sleep mode after running this write command, as soon as it wakes up from this sleep state it issues a reset.

I'm trying to understand the reason for this reset and if this behaviour is expected after writing to the otp header.

The code to write to the otp header is structured in a way similar to the following:

hw_otpc_init();
hw_otpc_fifo_prog((const uint32_t *) (&word2write), target_address >> 3, HW_OTPC_WORD_LOW, 2, false);
hw_otpc_disable();