Prevent deadlock situation in applyChanges.

A missing try/catch in applyChanges produced a possible deadlock situation.