terminate ctx from nn_global_term as well

This fixed the mutex problem in QNX.