Always write trailer record
Remove explicit number of scalars -> use length