boost optimization + close file