Always check write()'s return value

Even if a write() of 1 can't fail here, I guess I still need to check
it...