         guard let tempPort = MIDIOutputPort(client: client, name: outputPortName) else {
             AKLog("Unable to create MIDIOutputPort")
             return
-        }
-
-        // close any previous output port and dispose of it
-        if outputPort != 0 {
-            let uid = getMIDIObjectIntegerProperty(ref: outputPort, property: kMIDIPropertyUniqueID)
-            closeOutput(uid: uid)
-            outputPort = 0
         }
 
         outputPort = tempPort

    ///
    public func closeOutput(uid outputUid: MIDIUniqueID) {
        let name = destinationName(for: outputUid)
        AKLog("Closing MIDI Input '\(String(describing: inputName))'")
        var result = noErr
        if let endpoint = endpoints[outputUid] {
            result = MIDIPortDisconnectSource(outputPort, endpoint)
            if result == noErr {
                endpoints.removeValue(forKey: outputUid)

                result = MIDIPortDispose(outputPort)
                if result == noErr {
                    AKLog("Disposed \(name)")
                } else {
                    AKLog("Error displosing  MIDI port: \(result)")
                }
                outputPort = 0
                AKLog("Disconnected \(name) and removed it from endpoints and output ports")
            } else {
                AKLog("Error disconnecting MIDI port: \(result)")
            }
        }
    }


        }
    }

    /// Close a MIDI Input port by name
    ///
    /// - Parameter name: Name of port to close.
    ///
