Use pushd and popd to save and restore the current working directory.