close connection part written, seems to have minor bug that the server continues to keep trying to send stuff even after deleting the connection