Add: read now handles partially resent data; write now handles only parts of data acknowledged
Refactored close()