Folder watcher telegram send picture

I use the folder watcher to look for new images. I send these images out via telegram in my appdaemon app:

            self.log("Sending photo {} to user_id {}".format(data['path'], user_id))
            self.call_service('telegram_bot/send_photo',
                              title='*Alarm System*',
                              target=user_id,
                              file=data['path'],
                              caption=data['file'],
                              disable_notification=True)

But it looks like home assistant cannot read the file because it might not be fully written to disk:

2019-09-12T10:56:46.607612872Z stderr F 2019-09-12 12:56:46 ERROR (SyncWorker_18) [homeassistant.components.telegram_bot] Error sending file: Can't parse entities: can't find end of the entity starting at byte offset 32. Args: (510914350, <_io.BufferedReader name='/tmp/camera_doods_flur_unten_20190912_125645846584.jpg'>), kwargs: {'caption': 'camera_doods_flur_unten_20190912_125645846584.jpg', 'parse_mode': 'Markdown', 'disable_notification': True, 'disable_web_page_preview': None, 'reply_to_message_id': None, 'reply_markup': None, 'timeout': None}

I could image to use the webcam url (I have a webcam which points to the latest file) instead of the filename, but in this case the url might now be using the correct image too.

Or I could write some queue and delay in my appdaemon script.

How dou you guys solve these kind of issues?

Ok I solved the issue, the captain caused this issue. I have removed the captain option and everything works just fine.