misc: move exit status into trap handler