Groups whose subgroups of infinite rank are closed in the profinite topology