make sure that symbol name are valid c identifier and close files descriptors correctly