added fix for deleting table while key is being written, and test for it.