Fixed the concurrent file access issue for safe multithreading