JBTM-2287 It was possible that xa_end is called twice for an xaresource ...

...if a call to prepare fails

- backport from master to 4.17

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1170549
Upstream Issue: https://issues.jboss.org/browse/JBTM-2287