Fix coredump.

If top object is finished inside a macro parser could still expect to
read more keys. This caused segfault previously. Now parser should
report the correct error instead.

Reported by: Andrej Zverev