Bug 731362 - Merging layers (outside layer folders)...

...causes layer folders to expand

In gimp_image_remove_layer(), don't use the top element of
image->layer_stack as the new active layer, because it is simply some
arbitrary layer that was previously selected. That stack is only good
for finding the last active layer when returning from the channels
dialog. Instead, let the proper logic run and use the new active item
returned by gimp_item_tree_remove_item(), which is the layer below the
removed one, if any, or the one above it otherwise.