fix "too many open files": call free/close on created objects after commit