Tool panels will be mapped to ctrl-# bindings. If the panel is focused, the # binding closes it. Otherwise the # binding shows it (if needed) and focuses it. The esc key unfocuses the panel, but does not necessarily close it. Meta-w always closes the panel.
This is the scheme. Right now we only have 2 panels:
Command Panel: Ctrl-0, esc still hides it
Tree View: Ctrl-1, esc just unfocuses it