destroy writebatch to fix memory leak