Wrong Answer! code: CLEANUP. PLEASE HELP!!

I don’t know what is wrong with my code. I admit that it’s complicated but I’m a beginner. So please give it a try and help me finding the bug…
Problem Code: CLEANUP
Here’s my code:

Looking at your profile, it appears that you have solved this problem. So, this thread can be closed now.