close gracefully.
return EOF when it is EOF..
fixing #11
fix #11