Initialize the global transaction to null at initialization.

Otherwise, we have an uninitialized pointer in case of error.
Also abort the opening transaction in case of error.

No need to reset the pointer on the stack at end of function.

(cherry picked from commit 88e3e9623273df3ac9a86ee0147492f7ac6d5005)