Implement Grain termination when q is sent to input stream.