$cavityend required setting the number of the layer which is the end of the cavity in the device. This number needs to be set in the beginning of input file.
Example
$cavityend 30