Hey @zd1122!
There's actually a similar question here though the response is a bit buried. Table modals have somewhat limited functionality compared to standalone modals so a common pattern is to create a separate modal and then open that from your table as described in this thread. If you do that you should be able to use yourModal.close() to close it from a script or just use an event handler:

Does that work for you?