AV::Digestor thread safety fixes

This fixes potential thread safety issues introduced in 09f6fe1. The problem with the original code was that the "recursion-stopping" `nil` values could be seen by other threads. See [09f6fe1's comments](https://github.com/rails/rails/commit/09f6fe1#commitcomment-3593305) for more info.

This is targeting `master`, but a similar commit was also pushed into `4-0-stable`: 247aa53.

ping @rafaelfranca.