Delete errmsg if isn't NULL

A fix ported from https://github.com/rvagg/node-leveldown/commit/4112961978fedb18043808b404cfa498398faa61 where the problem was that errmsg wasn't allocated correctly and could change value before being returned as an Error.