Fixed stdin ctrl+d termination throwing an exception.