Provide a 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().
Update script JSON tests from upstream.