Avoid errors in layercombo when closing QGIS