memory freeing now working! in the previous code, we were closing the file twice which is why it was was giving us the double free or corruption error