Make fmpz_invmod behave like mpz_invert

The fmpz_invmod behaviour now mirrors the GMP version used.
This fixes the tests when compling against GMP 6.