Your loop termination condition is wrong:
if(fileLength == actualBytes)
if(fileLength == bytesCounter)
Apart from this, there could be different reasons, e.g. start and end of different connections could overlap or not match in different ways, your excerpt does not cover this part.
Have you tried to download the file with a single connection and compare the faulty with the working one to see the binary differences of the files? This could give some hints of what is going wrong.