Specify ::IO for writemime.

backport of ce4c7a33effdfcd9ce5f1a2c9766db3fb45dcb18
See #8352