midiinput: more robust unloading