More education is linked to better cognitive functioning later in life, study finds