add flag for closed sockets; revert status of current piece to avail