Changing the out_features attribute of the linear layer will not recreate the parameters, so you would need to assign a new layer instead:
model = models.vgg16(pretrained=True)
in_features = model.classifier[6].in_features
model.classifier[6] = nn.Linear(in_features, out_features)