Correcting some resource leak

Correcting some resource leak