Fix loss curve export

Related to this: https://bugs.launchpad.net/openquake/+bug/1157072.

I haven't even started to debug the `NaN` issue yet, because there were many other issues.

Things seem to be more stable now, but the fixes I've applied here are rather hackish. They're bandaids.

One of the major issues was that, in some cases, mean and quantile loss curve containers were being created _for each logic tree realization_--instead of just 1 mean and/or 1 for each quantile for the calculation.