Thailand's ex-PM Thaksin leaves hospital after six months in detention