adding try/catch for writing to ssl (in case both threads are writing to ssl)