io/bed: fixed writing of incomplete records