Finalizes chdir