I am not aware of any clean way of doing what you want to do. Per the
bash documentation:
"A script can export variables only to child processes, that is, only to
commands or processes which that particular script initiates. A script
invoked from the command-line cannot export variables back to the
command-line environment. Child processes cannot export variables back
to the parent processes that spawned them."
You could write the $PWD of your script to a temp file (/tmp/whatever)
then cd to `cat /tmp/whatever` (note backward quotes which designate
"output of") when you exit.