move output to driver, close output io stream only if the base class opened it.
Merge branch 'master' into develop