defined a function to end the connection with the MIDI subsystem