I think all these can now be refactored as `if_ok!(writer.write(...))` if I got it right. Would be nicer than having to match + fail manually every time.