Fixed missing import sys.
Fixed incorrect use of PROCESSED_DIR and added sending of email if the running script couldnt get the lock.