bugfix: terminate the program when exiting reader