os: restore testErrNotExist's working directory on os.Chdir success
os: restore testErrNotExist's working directory on os.Chdir success

The existing implementation calls os.Chdir expecting the call not to
succeed. This change restores the original working directory in the
case that the call does succeed.

Fixes #45407

Change-Id: I61c57f6858b9a9058226e45e24276c7af8913048
Reviewed-on: https://go-review.googlesource.com/c/go/+/308849
Trust: Emmanuel Odeke <bd234ba4276433f0e5fc7a8fa2d18274fa711567@orijtech.com>
Run-TryBot: Emmanuel Odeke <bd234ba4276433f0e5fc7a8fa2d18274fa711567@orijtech.com>
TryBot-Result: Go Bot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Ian Lance Taylor <87e9c6d529889242b7e184afb632328636553ab4@golang.org>

cloudflare/go,golang/go,golang/go,golang/go,CAFxX/go,nawawi/go,nawawi/go,CAFxX/go,cloudflare/go,cloudflare/go,golang/go,golang/go,golang/go,nawawi/go,CAFxX/go,cloudflare/go,cloudflare/go,CAFxX/go,nawawi/go,CAFxX/go,cloudflare/go,nawawi/go,nawawi/go,cloudflare/go,CAFxX/go,golang/go,nawawi/go,cloudflare/go,golang/go,CAFxX/go,CAFxX/go,nawawi/go