free memory in the end of program