Added code to correctly remove command window when redrawing

fixes #114