Reason of bug: at the end of writing indices the "buf" was written double times. Fix: At the end of operation skip one WriteLine. Test case for issue CR25740