Fix various closure-related issues.

In these places we wrongly fell back on auto-close, which is slow and
wrong.