use 'write handler' signature for waiting completion of file writing