Fix concurrency in BsonNode.freeze()

Currently, BsonNode.freeze() isn't sufficiently protected against shared usage. It should use an atomic, a lock or a volatile variable.