[Bug 56837] Bad file pointer after a file write in appending mode