bugfix in transactions. handles databases with auto-close