GDB and OpenOCD flash erase

I am trying to get GDB working with OpenOCD for STM32F3xx on Windows 10. I am getting “error finishing flash operation” after my “load” command. What I have discovered is that the flash does not appear to be erased because if I use STLink Util to erase the chip the next time I flash the MCU it works fine. Then I change my code and once again the flash error occurs.

My interface is STLink V2 (on Nucleo F303R8) and I use STLink-V2-1.cfg, for the target I use stm32f3x.cfg.

Please can someone help me resolve this?

Sid