actually really fix file handle leak in derivative generation