Fixes an unreported bug where it was possible to select a layer tree group
and remove even when it contained required layers.
When removing layers/groups, the following checks will now also recursively
test layers and not just directly selected layers:
- test for layers with unsaved changes
- test for layers with active tasks running in background