Add test to see if specified gid is free

The errormessage uf you specified a GID that was already taken was not really helping for debugging, and the lack of this test caused logentries ('groupadd' was called anyway, which errored).