You'll notice I commented out the

//ni.unloadNodelet (name, manager);

This is actually not correct.  There are times when you want to keep the manager up but kill a different launch file that loaded nodelets into that manager.  This prevents them from unloading.

Really the unloadNodelet call needs a timeout.

Josh