Fix stdout redirection in PySpark.

Fixes a stdout redirection problem [described on the spark-users mailing list](https://groups.google.com/d/topic/spark-users/wGX5jO0w1Mw/discussion).  Thanks to @woggling for suggesting `os.open / os.dup2`.