Correctly write and restore the console title on the stack (fixes #1782)

According to http://invisible-island.net/xterm/ctlseqs/ctlseqs.html (search for `Save xterm icon and window title on stack.`) for writing the title to the stack `22;0t` is used instead of `22t`, the same for restoring the title.

I have tested it in OSX, it works in `xterm` and `iTerm`, but not with `Terminal.app` (included with the system).