Change order - restore standard error output first.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Fix. Use correct magic cookie.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Raise Magic::LibraryError appropriately from Magic#flags_to_a when the underlying Magic library is closed.

Plus, cache the map of flag values-to-names on the class level.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>