proper shutdown of cli