Protect all public functions against invalid context

- change return argument from void to int
- update documentation
Always set socket to -1 on close()
Returns -1 on invalid mode in modbus_rtu_set_rts