connection.close: allow multiple times and end event.