Being too thin in middle age might be bad for brain health later in life, a new study suggests.