Improve diagnostics for restore_cwd failure.