Release the GIL if necessary before calling Replace in main thread

Needed if (re)replace called in N++ callback