Release imgRef

release imgRef to solve memory leak.
Merge pull request #1 from mikekloster/patch-1

Release imgRef