The profinite completion of accessible groups