Closes open transactions if de/serialization fails for any reason,
avoiding the object to be in a potentially confused state.
Thanks to Michael Granger (ged@faeriemud.org) for the heads up and test case.
FossilOrigin-Name: e6e52675510533da8a26b0e2f0b2f73505a3b4ee0c94b123c37089489ed7745a