Added command thread shutdown support