Exit early when $PWD isn't set. Remove unused unistd.h include.