Moved lines that clear gmagick resources to distinct method; updated unit-tests