Fix file corruption when failed to create a reference chapter track.
Fix file corruption when failed to create a reference chapter track.

l-smash/l-smash,dwbuiten/l-smash,mstorsjo/l-smash,mstorsjo/l-smash,maki-rxrz/L-SMASH,maki-rxrz/L-SMASH,canbal/l-smash,l-smash/l-smash,silverfilain/L-SMASH,silverfilain/L-SMASH,dwbuiten/l-smash,silverfilain/L-SMASH,canbal/l-smash,l-smash/l-smash