Flush existing debug messages before writing an error to stderr. stderr
is usually unbuffered and stdout is usually buffered. This results in
odd looking output when an error occurs and both stderr/stdout are
printed on the same console/file. More precisely, the error message is
printed in the middle of previously emitted debug messages.
Signed-off-by: Michael Kurth <mku@amazon.com> Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>