Actually, it isn't. It's just that the stream won't go 'bad' until after you have tried and failed to read a value, by which time you are committed to finishing the loop.
Change
1 2 3 4
while (openFile.good())
{
int x;
openFile >> x;
to just
1 2 3
int x;
while (openFile >> x)
{
Later on, your calculation of the average will be wrong (most of the time) because of integer division.
but it is reading the last line twice. Idk what I did wrong.
This is probably because you used good() to control your input loop instead of the actual read. Remember that you are checking the file state before you try to read the file, you need to check the file status after reading the file.