Another try at close_proof that should behave better w.r.t. exception handling.