finish command-line function and quit function