adding a close connection function and calling it in server main when done with a connection