fix missing fclose bug