added delays to get the sockets to close properly.