EVERYBODY IT'S OK!
JOSHUA PARIS BATTY << has discovered the solution. I'm accidentally iterating over each file twice. I was originally using a while loop and iterating i at the end of it to move through the files. However, I should have taken out the final "i++" once I changed it to a for loop. Woops!