Implemented locking on Windows.