Added socket close on page deletion.