The issue was caused by leaking error messages caused by getting OIIO texture handle for built-in images.