Reducing scope of each promise for OS.File