add hadError argument to 'close' event