Prevent scancel invalid memory reference

This can happen if the specified job ID is not found.