Having a sense of purpose may help you live longer, research shows