Changing the locking on the XBPython executor

Changing the locking on the XBPython executor since it was causing a temporary deadlock preventing scripts from exiting cleanly. This closes #14048.