factor open/close/read/write/print blocks out of IO_Stmt#translate