Added a closed check prior to calling submitNext and added a break for statement exceptions caught in the main loop.
Added a closed check prior to calling submitNext and added a break for statement exceptions caught in the main loop.