Fix gmagick memory leak

We need to unset gmagick instance to free memory. And unset layers instance because it contains reference to gmagick too.
Agreed. This seems to be ready to land then - or do we need some docs somewhere about this particular problem and `freeing` mechanism?