Fix various crashes occurring under Mono

Allow threads to cleanly exit when recieving messages