Flush uart buffer on error