It sounds like your phone is running out of memory.
Depending on how old your phone is, the only fix may be getting a new phone. However, this could also be happening by having a lot of apps open in the background. I recommend turning off your phone and turning it on again to see if the same error occurs.