The db->fp can be NULL if commonio_unlock() is called when the shadow file is opened but did not exist before.