def closeEvent( self, event ):
        """
        Cleans up the scene before closing.
        
        :param      event | <QEvent>
        """
        if ( self.cleanupOnClose() ):
            scene = self.scene()
            scene.cleanup()
            self.setScene(None)
        
        super(XNodeWidget, self).closeEvent(event)