Close mode button when an error occurs. close #229.