Generated serialization: move post hooks to the finally block.

That, with previous commits, fixes #18.