Fix killCurrentThread error on exit context switch