Free the linkedList before end of execution