handle pipeline exiting properly