Fixed an error when no onclose callback handler is provided