def finishEditing(self, tag):
        """
        Finishes editing the current item.
        """
        curr_item = self.currentItem()
        create_item = self.createItem()
        self.closePersistentEditor(curr_item)
        
        if curr_item == create_item:
            self.addTag(tag)
        
        elif self.isTagValid(tag):
            curr_item.setText(tag)