Add callback to writer close