Don't require HistoryManager to have a shell

Allows use of HistoryManager to work with history database without a shell instance present.
Merge pull request #3645 from minrk/histnoshell

Don't require HistoryManager to have a shell.