fixing #563 by using delayed removal for a layer that's loading

Fixing #563 

Not the most elegant fix, but on the other hand it's not a super urgent bug. This fix will wait for the layer to fully load before removing it, eliminating the error message in the console.