Wait for operation to complete when writing to SD card

The actual data transfer does not complete when the 'dd' operation
exits. Pulling out the removable media too soon causes corruption.

Make sure the utility waits till data is synced.

BUG=None
TEST=manual
   . used cros_write_firmware to put an image to the SD card

Change-Id: If60107194d9c830525ae32f6269904028d9b359d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46765
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
diff --git a/host/lib/write_firmware.py b/host/lib/write_firmware.py
index 8515ff7..95e0b5c 100644
--- a/host/lib/write_firmware.py
+++ b/host/lib/write_firmware.py
@@ -689,6 +689,8 @@
 
     args = ['if=%s' % image, 'of=%s' % disk, 'bs=512', 'seek=1']
     self._tools.Run('dd', args, sudo=True)
+    self._out.Progress('Syncing')
+    self._tools.Run('sync', [], sudo=True)
 
   def SendToSdCard(self, dest, flash_dest, uboot, payload):
     """Write a flasher to an SD card.