$IgnoreEOF specifies whether Mathematica should terminate when it receives an end-of-file character as input.
$IgnoreEOF defaults to False.
$IgnoreEOF is assumed to be False if the input to Mathematica comes from a file, rather than an interactive device.
See The Mathematica Book: Section 2.13.1 and Section A.7.5.
See also: Exit, Quit, $BatchInput.