First of all, you should write [/code] instead of [code/] at the end of your code block.

Second, if your intent was to optimize each individual asset, you are certainly not doing that. You must put your optimize() call inside of your asset loop(). To be explicitly clear, your while loop must be using the loop() call, and the optimize() call must be in that same exact while loop.