shelve: move shelve-finishing logic to a separate function
With future obs-based shelve, finishing shelve will be different
from just aborting a transaction and I would like to keep both
variants of this functionality in a separate function.
shelve: move unknown files handling to a separate function
This change has nothing to do with future obsshelve introduction,
it is done just for readability purposes.