SPARK-1579: Clean up PythonRDD and avoid swallowing IOExceptions

This patch includes several cleanups to PythonRDD, focused around
fixing SPARK-1579 cleanly. Listed in order of importance:

- The Python daemon waits for Spark to close the socket before exiting,
  in order to avoid causing spurious IOExceptions in Spark's
  PythonRDD::WriterThread.

- Removes the Python Monitor Thread, which polled for task cancellations
  in order to kill the Python worker. Instead, we do this in the
  onCompleteCallback, since this is guaranteed to be called during
  cancellation.

- Adds a "completed" variable to TaskContext to avoid the issue noted in
  SPARK-1019, where onCompleteCallbacks may be execution-order dependent.
  Along with this, I removed the "context.interrupted = true" flag in
  the onCompleteCallback.

- Extracts PythonRDD::WriterThread to its own class.

Since this patch provides an alternative solution to SPARK-1019, I did
test it with

```sc.textFile("latlon.tsv").take(5)```

many times without error.

Additionally, in order to test the unswallowed exceptions, I performed

```sc.textFile("s3n://<big file>").count()```

and cut my internet. Prior to this patch, we got the "stdin writer
exited early" message, which is unhelpful. Now, we get the
SocketExceptions propagated through Spark to the user and get
proper (but unsuccessful) task retries.