Make chdir and returning exception safe