No, the script has no syntax errors if that's what you mean by } sub-ending bracket missing? I just copied and pasted it quickly to show that I think this is where the problem lies. I still can't figure it out and it's been hours.
I'll be posting an updated version of the script with an output included, I really can't figure this out :(