eliminate global file handle

basic test for read/write file
cleargame to free all memory