Fixed bug in hashmap freeing that can cause a segfault

When the client connection is closed, the hashmap is freed, but the
pointer to it was not set to null. Then when a new connection is made,
the key_hash pointer was checked if it points to null before trying
to access the hashmap. This caused a segfault when trying to
dereference the function pointer for the hash function, so it's now
being set to NULL to be able to test whether it was freed.