Perform rehashing of the old keys after resizing the table.

Also refactor code for freeing the table array.
Remove an assertion as it does not hold true anymore.

Since we are rehashing the table, the number of free buckets in the
resized table is non-deterministic.