Fixed exception being raised when generator prematurely cancelled.