you can not decide which enemy's name to output in cycle, because in the first step of the cycle you simply can not predict what names come in next steps of those cycle, so put result output after cycle
why are you increasing count variable in the cycle? you are not sure how many steps you will have? read the problem situation, number of steps is defined and does not need to be changed, also those types of cycles are organised with "while" keyword.
you never reassign mindist variable, so on every step you will have the condition true and you will output every enemy's name
commented "string closestenemy = " line is actually more correct, you should move in that direction