flush writer after stopping