Fix race in ReadWriteLock.(try)acquireWrite, and add a partial test case for that.