Makes sure that stdout is restored.