LayerGroup removeLayer problem on removing layers solved

The removeLayer function removed layers even if it did not belong to it.
So, I changed the if condition to even check for the existence of layer
with in the layer group. To do this, I also moved the delete statement
after the if statement.