Fix issue with disposal of command line app in testing, clean-up