handl if stderr is also closed