Handle EOF correctly with readline