Fix bug in DIMES write finalize method