Raise proper errors in fs.cwd and fs.chdir