Synchronizing Threads in preporcessing.py