Added mutex to handleFileRequest function