Why do I have "Closing" transactions idling for several minutes when I run SHOW TRANSACTIONS?

There are some empty currentQuery transactions shown with the status "Closing" and they appear to be hanging and also blocking other transactions for several minutes. I configured both dbms.lock.acquisition.timeout and dbms.transaction.timeout but I still get them.