Acquires the write lock. This method waits until all readers have released the read lock. It then acquires the write lock and returns.