Close console when it loses focus but it is still on screen

Close the console when it loses focus, like when you die (respawn screen), a formspec "opens", etc.