This is a normal behavior of the STM32F1xx Flash, You can write to an address a data of 16-bit only if the content of address is equal to 0xFFFF
if you write a second time, then the Hardware logic will not write it. You can refer to our Flash Programming Manual PM0042 ( June 2009) : http://www.st.com/stonline/products/literature/pm/13259.pdf , See page 25/33 :

Bit 2 PGERR: Programming error
Set by hardware when an address to be programmed contains a value different from '0xFFFF' before programming.