Move chdir after mkdir.