Wrap readline to catch unable to write at exit.

Remove using open() to touch the history file. If readline can't
open it, it won't be written to anyway.