Fix ghci crash when the user code closes stdin

Now that we share stdin with the program, we have to check for
handle-closed as well as EOF, as the program might have closed
stdin.