fix: avoid segfault at exit when using custom memory functions

This extends the fix introduced by 956534e0 to Windows processes
dynamically loading libxml2.

Closes #256.
4 jobs for flavorjones-work-around-xmlcleanupparser-segfault in 18 minutes and 22 seconds (queued for 3 seconds)