Cleanup of MIDI writer