A positive attitude can protect your memory as you age. Here’s how to improve your outlook