cleaned up memory freeing at close
trying to fix chunk delete race condition