Update terminal.js

If the panel triggers 'resize' before a terminal panel was opened/created the this.terminals isn't defined and so the access to this.terminals[terminalId] forces in a crash.