Cognitive impairment from early to middle adulthood in patients with affective and nonaffective psychotic disorders