AI can better retain what it learns by mimicking human sleep