Changing end condition to 'close' not 'end'

- Running callback on 'end' event seemed to not always capture the output data. Whereas 'close' is on the close of the stdout stream