add lock for Close()
add locks to all encryption contexts
Merge remote-tracking branch 'upstream/master'