Ensuring that modules are stopped in the correct order - TRUNK-4134