Addressing memory leak problem and changed queue

- Correct Use of new/delete and malloc/realloc/free
- Freeing the closed set, queue and the resulting path
- Added option queueIncreaseCapacity in the config structure.