Why call `p.dump(f)` twice, once before the `try` block, and one inside it?