High stress may lead to lower cognitive function, study finds