If you have the find/replace toolbar (or other toolbar panels) open, pressing escape should close them before trying to close VisualEditor entirely.
As-is, pressing escape does try to close them iff one of their inputs has focus. It'd be a more consistent user experience if it always closed such things, regardless of focus.