When an underlying MIDI device does not understand/support a MIDI message (very common with sysex messages) it returns an error code.
With this fix MIDI output can continue gracefully even after an emulated game sends an unsupported message.
midiStreamStop can freeze the process when there has been a NOTE-ON message without a corresponding NOTE-OFF.
Just removing the call to midiStreamStop and letting the midiStreamClose below it do the entire stopping and closing fixes that.