Self-refreshing memory in artificial neural networks: learning temporal sequences without catastrophic forgetting