Don't traceback if a gid is specified instead of a group name

Fixes https://github.com/ansible/ansible/issues/9796