added closing of connections to stop servers from choking