Update fileManager.js

change sync to async