Fix an unreported bug. Port to 0.6.

3D diagnostic quantities computed on demand did not work with automatic
vertical grid extension: saving "cts" could make PISM create an output
file with the number of z levels corresponding to the old vertical
grid (before automatic extension). This lead to a crash when a properly
"vertically extended" field was saved.
Fix a stupid bug in the fix for an unreported bug.

(See b102325.)
Fix #277. Port to 0.6.