libctdb: fix writerecord() to actually write the record.