cleaning up command state