More meaningful exception when reaching past end of ASN.1 stream.

Properly close ASN.1 decoder in exception paths.

A way to trigger the exception is running ScriptTest.dataDrivenValidTransactions().