initramfs: add write error checks