Fixed a bug in pdf weights for OSL closures. Improved code.

`e` isn't very clear, I suggest renaming it to `closure_count` or something along these lines.