registry/session: fix panic in GetRemoteImageLayer

Fixes #7860
@discordianfish I thought I should close it in case there's any case when it's not nil.