lavf/segment: remove duplicated and inconsistent cleanup code in seg_write_packet()