Ensure that stdout is restored if something goes wrong during install.