Added writingThread != null check to TwoWayReentrantReadWriteLock

Signed-off-by: Ross Allan <rallanpcl@gmail.com>