hash_map_remove: handles non-existent key; free linked list if it's empty