Poor sleep linked to dementia and early death, study finds