remove on_close handling
process remaining data when receive returned 'closed'
allow code == nil
properly call on_close(was_clean,code,reason)