Add destructors for MySQL driver and fix some memory leaks