[PATCH v2] fix: release transaction before releasing handle