There are still opportunities in midlife to prevent dementia or delay its onset, a new study finds.