Make slurmd lock order consistent

helgrind found the locks here were being make in reverse order
after the initial locks at the top of the function.
Speed up slurmctld shutdown

especially when in memory debug mode