Check if tx is open before to stop transaction
Merge pull request #368 from lvca/master

Check if tx has begun and db open before to stop tx