Moved out HTTP CloseNotify into new function