Properly check for termintated print streams.

All PrintStreams need to be checked for termination via
the checkError method (i.e. they do not throw exceptions
if the underlying resource is closed they just swallow
the error). To do this this change extracts print and
printLines combinators (partially so this can be tested,
but also because they are generally useful).

To demonstrate this issue it is possible to construct
an application from a process of:
  Process.constant("y").to(io.stdOutLines).run.run

And then try to run the app with something that closes
the output stream, for example:
  java -cp ... yes | head

The correct behaviour for this is the program should
exit after printing "y" 10 times. However, before this
change the program would print "y" 10 times than run
forever.
Update pull request #181
Merge pull request #235 from MrAIring/update-#181

Update #181