It sometimes happens that the flash does not work correctly on some SD memory cards. There can be several reasons for this:
The SD card is faulty (old, worn out, etc.).
The SD card is not compatible. The Raspberry only works with class 10 SD cards of 16 GB or more.
The SD card brand is unreliable.
In this case, the solution is to change the memory card.