Fix gmagick memory leak

We need to unset gmagick instance to free memory. And unset layers instance because it contains reference to gmagick too.
when `destroyGmagick` is not called explicitly this would leak memory,.. no?