Mac - don't attempt writing to stream if not connected