Experienced error running code in the writeThread.
Revised the exception handling