Delete cmd objects after use to aviod memory leaks