Exception in TransactionImpl#begin method can leave thread in unusable state

begin() method marks thread as transactional with threadFlag too early. 
If some operation throws exception before transaction state became ACTIVE when thread can't start new transaction any more.