Anxiety and sleeping pills 'linked to dementia'