Fix crash due to race condition between threads happening during enablement/disablements of network simulator.