Fixed more possible memory leaks in windows versions of library.