Fix and refactor driver prompt restoration

MSP-8988

Msf::Ui::Console::Driver::Prompt#restore_prompt not restores the prompt
correctly whether or not metasploit_instance nil.