HPCC-10591 Free library graphs before killing memory manager

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Merge pull request #5241 from ghalliday/issue10591

HPCC-10591 Free library graphs before killing memory manager

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>