rdbms: fix transaction flushing in Database::close