Fix for StrictMode error.

When the device lost connectivity, a StrictMode error could be thrown since
the stream was never closed.
Merge pull request #211 from colund/master

Close stream in case of an exception