Properly close shelf upon restart

This fixes some data loss (plugins, repos, etc.), as shelves
are only written back to file if they're explicitly closed.
Merge pull request #136 from arrrrr/fix_restart_data_loss

Properly close shelf upon restart