Cognitive ability in early adulthood is associated with later suicide and suicide attempt: the role of risk factors over the life course