Don’t explicitly dispose of your client; the system automatically disposes all clients when an app terminates. However, if you call this method to dispose the last or only client owned by an app, the MIDI server may exit if there are no other clients remaining in the system. If this occurs, all subsequent calls by your app to MIDIClientCreate and MIDIClientCreateWithBlock fail.
https://github.com/waddlesplash/QMidi/blob/de0a2b1b3ccc494114353d3eee863bebd6811618/src/OS/QMidi_CoreMidi.cpp#L92-L100
Quoting documentation: