Add flusing in REPL

REPL now flushes sys.stderr and sys.stdout in each cycle. Found out that
write_through parameter of TextIOWrapper is about internal buffer rather
than buffer.flush().