exit python process without hanging