Adding cmd deinit to core and cmd_api