Memory leak on shutdown not happening