Made Block::purgeExpired() check for read-only mode.

Change-Id: Ida4f82b8e17a0f7ba872e46fd8a4c87831e5254f
(cherry picked from commit 8feda3a26fa71128e7f2cfcdbd5fe7858f696b6e)