Be more careful on command exit.