Handle stubbing IO#write and then calling IO#reopen.