Fix memory leaks of RIFF/SF2 export and slightly wrong RIFF padding logic.