Flush the buffered stdout before app exit