switch order of locking g_tchild_table and other locks

since we need to lock g_tchild_table before the child
struct in terminal_input, we have to reorder locks
in terminal_new and terminal_delete. i forgot that
when a child is locked, all the screen + global
resources are implicitly locked along with it. but
in terminal_{new,delete} we were locking the screen +
global resources before locking g_tchild_table, which
could cause deadlock. (thanks helgrind! :D )