write timeout + error handling (try except for callbacks)