Is it possible to destroy the stream?

I have a scenario where I need to query a large number of rows and stop processing after some conditions are met, is it possible to programmatically close/destroy the stream, so that it stops reading results from the DB and it returns the connection to the pool, from inside the "data" event function?