Sync output devices on exit
Sync output devices on exit

Mbed retarget does an `fflush` on stdout and stderr on exit - this
flushes the C library buffers (if it is buffering), but doesn't
flush any device buffers (eg UARTSerial's TX buffer). Add
sync() calls to the output device to do this.

kjbracey-arm/mbed,mbedmicro/mbed,mbedmicro/mbed,andcor02/mbed-os,kjbracey-arm/mbed,mbedmicro/mbed,andcor02/mbed-os,andcor02/mbed-os,kjbracey-arm/mbed,andcor02/mbed-os,mbedmicro/mbed,andcor02/mbed-os,mbedmicro/mbed,kjbracey-arm/mbed,andcor02/mbed-os