sstables: random_access_reader: unify input stream close code
sstables: random_access_reader: unify input stream close code

Define a close_if_needed() helper function, to be called
from seek() and close().

A future patch will call it with a possibly disengaged
`_in` so it will close it only if it was engaged.

close_if_needed() captures the input stream unique ptr
so it will remain valid throughout close.
This was missing from close().

Signed-off-by: Benny Halevy <23c997c90eb8537635e9392d48e7af1bf1b2ca22@scylladb.com>

avikivity/scylla,scylladb/scylla,avikivity/scylla,scylladb/scylla,scylladb/scylla,avikivity/scylla,scylladb/scylla