Fix cleanup for uninitialized stdout Fixes #101375 by disabling buffering even if the buffer was not initialized yet.