Dementia patients may briefly regain memory months before death