Making sure that write propagates errors

Signed-off-by: Johannes Tuchscherer <jtuchscherer@pivotallabs.com>