<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def close(self):
 """ Closes Serial port, or TCP-Socket connection """

        if (self.__ser is not None):
            self.__ser.close()
        if (self.__tcpClientSocket is not None):
            self.__stoplistening = True
            self.__tcpClientSocket.shutdown(socket.SHUT_RDWR)
            self.__tcpClientSocket.close()
        self.__connected = False