fix fclose bug