Close the publish connection (if established)

def close_pub(self):
        '''
        Close the publish connection (if established)
        '''
        if not self.cpub:
            return

        self.subscriber.close()
        self.subscriber = None
        self.pending_events = []
        self.cpub = False