esc button does not work

office can not be closed by esc button.

Why should it be closed by ESC?? Please edit into your question all relevant information (OS, LibO version, etc.)

Esc is meant for “dismiss last dialog” i.e. a “universal” shortcut for Cancel

Try Ctrl + Q