Run application handlers on stream error.
Patch from Owen Taylor that fixes LM-104 where application handlers weren't run on stream error.
It also fixes a problem where a variable is incorrectly overwritten.
Colin WaltersFrederic CrozatJosh BeamMartyn RussellRichard HultRoss BurtonSjoerd SimonsTim RobbinsTollef Fog Heen