I suggest that you don’t use 's functions. They may be great, but you stated you want to learn C++ in UE4, so just think the boilerplate out yourself.
Second suggestion. You don’t need to fill arrays and do this in separate loops. In your initial actor loop test the distance and just keep the reference to the closest (get distance, compare if less than current distance, if so set reference. On the first one you need to do something different, either have a flag or specially initial value such as -1 for the distance that you compare against so the first actor is always set as the shortest to start), no need to fill an array then reloop that.
Reason for crash. Most likely is an the index is overflowing your Array, that’s not a safe way to access an array. You should initialize the int32 to 0, and then make sure it is less than the length of the array minus 1 before you try to get something out of it, otherwise, that will crash. But, there’s no way to tell for sure without debugging it. Set a breakpoint in your code and run it in debug then step through each line and see where it crashes.