Add code to clean up file descriptors when socket is closed