afaik, you need semicolons after these two statements (correct syntax shown):
{_Dist=_Unit Distance _x ; If (_Dist<_minDist) Then {_minDist=_Dist ; _Closest=_x};} ForEach _Found;
{if (_x != _unit AND alive _x) then {_found = _found + [_x]};} foreach _list;
(ofp functions are a bit inconsistent when it comes to expecting semicolons, but generally you must always put them at the end of an if, or at the end of an if-else clause). E.g.
if (condition) then {
...;
...;
};
if (condition) then {
...;
...;
} else {
...;
};
Note that you can drop the semicolon if the 'if' consists of one statement only, AND the one statement has a semicolon:
if (_myvar == 3) then {
hint "var was 3";
}
I notice that in 'init.sqs' you say -- find=PreprocessFile "func\findClosest.sqf" -- yet in your most recent mission, that directory doesn't exist. Although that wouldn't explain why the function runs correctly once. Still, either of these things could be the problem (not near ofp so i can't test).