dict.c/dictRehash: check if rehash ends at last

Without checking if the rehash operation ends at last, protential inconsistency may occur.
e.g. `if (d->ht[0].size == 0)  return *;` (line 409 488 882)