more robust signal handling to force forked matlab to close