Profinite groups associated with weakly primitive substitutions