Use of the io module to write file in utf8. This avoids errors on some systems when calling pandoc