Error on Writing to s7 plc

Can some body tell me why I get this error?
I connect to s7 1200 plc and try to write value to it and some times not always get these errors.


The StatusCode that goes along with that description is Bad_NotConnected, so probably it was caused by a write while the device was not connected for some reason.