OnClose must be an object