Processing algorithms are on a separate thread than QgsInterface. Accessing interface (QgsProject.instance()) from a processing algorithm works poorly and often make Qgis crash.
You should return the layer in a sink at the end of the algorithm.