A theory for how sensorimotor skills are learned and retained in noisy and nonstationary neural circuits