Graceful thread stop and new file name format