dfu: add write error handling