wiasane: First steps to improve the internal error handling
wiasane: Further steps to improve the internal error handling

Check if connection is still alive before sending commands.
winsane: Provide Device IsOpen function to check device state
winsane: Allow options to be retrieved while device is closed
wiasane: Handle device state using reference counted uses

Another step to handle connection interruption. Next step will be
to completely decouple the local WIA interface from the network
interface and handling most of the WIA commands locally.
wiasane: Decouple setting scan mode from session and device state
wiasane: Remove obsolete entry conditions
wiasane: Set resolution only once using X resolution

Abort if Y resolution does not equal to X resolution.
wiasane: Fixed OpenScannerDevice if session was previously closed
wiasane: Decouple pixel window from session and device state
wiasane: Fixed memory corruption due to access of freed memory

This also led to the situation that the scanner could get stuck
in ADF scanning mode.