shape.input: keep shared ptr to mapped region

Avoids a potential crash if a mapped region is deleted from the global cache but still in use by the shape.input.

Fixes #1877.