fixing FS close errors