added flush&close