Sounds like it is a bad thermostat. That would explain why the car think's it is overheating and the fans kick on and the tank starts putting coolant back into the tank. A bad thermostat will send false readings to the cars CPU causing the codes to flash. I would start there.