Fix read-write locking in Windows