Can anybody please help me make sense of this error message?
*** glibc detected *** ./kprank_new3_norm: munmap_chunk(): invalid pointer: 0x00000000096912d0 *
It appears that code you are writing(?) tries to access memory you don't have rights to.
./kprank_new3_norm: munmap_chunk(): invalid pointer: 0x00000000096912d0 ***
And based on your GDB output you are maybe trying to close a file that wasn't open, or maybe already closed due to it not being in scope any more? It's hard for me to say without seeing your code.