During upgrade, change directory in main process instead of workers.

This Fixes #468 by making sure the new `cwd` will be used for all the
workers spawned in the future.