The impact of frailty and cognitive impairment on quality of life: employment and social context matter