Use blocks

Use the block-version of Dir.chdir.