Avoid crash in case multiple templates are found
mainwindow was deleted, but !paths.isEmpty() would still be valid