Merge pull request #33 from jimpurbrick/master

Always call clientDisconnected to avoid race.
Explicitly close PrintStreams so they flush to the client socket before it's closed.

We ran into an issue in Buck where the nailgun C client would have its
socket closed unexpectedly by the server before it received the exit
command (X).

I went through NGSession with a fine-toothed comb and found its use of
PrintStream was unsafe: it used the constructor `PrintStream(OutputStream out)`
which explicitly does not flush any data unless you call `flush()` or `close()`.

This diff simply ensures we always explicitly call `PrintStream.close()` to
flush all data before closing the client socket in `NGSession`.

The vast majority of this diff is whitespace changes due to adding a
try / catch block (I assume we can't add dependencies on Java 7
try-with-resources), so add `?w=1` to the end of the github URL to
view it without whitespace changes
Merge pull request #52 from bgertzfield/flush-print-streams

Explicitly close PrintStreams so they flush to the client socket