write_kafka: fix two leaks on error