Pass lock as a parameter to subprocesses to make task counter work on Windows