[python] How to stop flask application without using ctrl-c