Reward Prediction Errors Shape Memory during Reinforcement Learning