found cause of pthread error

thread1 was still writing to g_pan_term when
plugin_free was called, which sent a kill message
to the child g_pan_term was connected to, which
caused the io loop to finish and the terminal to
be deleted. thus, when thread1 tries to write input
into the terminal, the child pointer is invalid
and so of course the mutex is invalid also.