cleanup from tables and keys correctly (free khash table)