After I make a factory reset I can flash my Spark Core.
When I try to flash it the second time the LED does what is should do but after that it starts continues running the old firmware. I have to factory reset it again to make it work.
When the core encounters a problem flashing new firmware, it will try to recover by running the previous firmware and failing that, it will try to run Tinker.
Often this kind of problem involves your code not allowing the flash process to run to completion for some reason. You can work around this by having an input pin the forces your loop to bypass your code so you can flash.
If you post your code here or online, folks here can help you more.