[SPARK-25771][PYSPARK] Fix improper synchronization in PythonWorkerFactory