FELIX-2821 Apply patch by Stephen Flynn (thanks alot). Basically when closing the DependencyManagers, the manager list is copied, reversed and this reversed copy is iterated. And added an integration test to prove correctness.