Flush streams before quitting in singleCommand mode

Also, eliminate a race condition when starting CommandScheduler.

Also, handle asynchronous exceptions properly in ConsoleTest

Bug: 6363212
Change-Id: I8a9dc310bf50721b2d15d6efcc99ee8c9793992d
4 files changed