EM7455: Sporadically can't change APN, still old one in use

We are using EM7455 managed with qmicli in Ubuntu.
Recently got a SIM that supports multiple APNs , each with different service.

We use following sequence to change APN:
qmicli -d /dev/cdc-wdm0 --wds-start-network=APN1, --client-no-release-cid

qmicli -d /dev/cdc-wdm0 --wds-start-network=APN2, --client-no-release-cid

Problem is that sometimes, connection with APN2 doesn’t succeed, and in serial console we see modem still uses the previous one:
at+cgdcont?
+CGDCONT: 1,“APN1”,"",“0.0.0.0”,0,0,0,0

Does modem save the APN in Flash ? Why changing the APN sometimes doesn’t succeed?
We have SINGLEAPNSWITCH custom setting to 1.

Thanks.

yes it is in the modem flash.
maybe it is an issue with qmicli, I assume changing the APN with AT works every time.
I’d suggest not to reprogram PDN1 every time you want to connect with the other APN.
Why not program APN1 with your first APN and APN2 with the second apn?
this way you can have two sessions parallel.