Closing InputStream of a running process
To add to @ChrisWue's answer I would pull the Process away from the actual processing of it's data. IE: Make a separate class that takes a stream and does processing. Think about it this way: what is your code doing? It is taking data off of some InputStream and checking for a specific keyword. Does that processing code need a Process instance to do that? Nope! You could pass your code any InputStream and it would be able to look for a keyword. Making sure your methods are only given exactly what it needs dramatically increases testability, flexibility, and re-usability. 

For the second part actually using the Process' Input/Output/Error streams. If you read the JavaDocs you will find this:


  By default, the created subprocess does not have its own terminal or
  console. All its standard I/O (i.e. stdin, stdout, stderr) operations
  will be redirected to the parent process, where they can be accessed
  via the streams obtained using the methods getOutputStream(),
  getInputStream(), and getErrorStream(). The parent process uses these
  streams to feed input to and get output from the subprocess. Because
  some native platforms only provide limited buffer size for standard
  input and output streams, failure to promptly write the input stream
  or read the output stream of the subprocess may cause the subprocess
  to block, or even deadlock.


Basically, what this is telling me is that you need to make sure you are managing all of these streams appropriately. If you close one of the processes streams prematurely you have to be sure that the Process can handle that case. Most applications will crash or exit with an error code. Unless you know you won't break the Process you're trying to run be sure to process all the data from these streams until that process is done. You could use a simple thread which just reads and discards the data if you don't need it.

Just a thought but if you are controlling the application you are running as a Process you could possibly tell the application to close gracefully by sending it something using the OutputStream.