Added return; statement in NetworkLoop after socket is closed