You were missing a line-ending or a pipe-symbol between 'return' and the command following it, so the write command to clear the .txt was the command line for the 'return' command, trying to return it as a text string to whatever called it. fixed:

Code:
on *:text:!clear:#aribun21: {
if ($nick !isop $chan) return
{ write -c list.txt 
msg $chan list reset. }
}