Avoid fatals in begin/commit/rollback if close() was called

Change-Id: I3c555ece5c1e16c6ffcdbec6645d659531400a1b
Merge "Avoid fatals in begin/commit/rollback if close() was called"