close socket and fire onClose on feof while reading. Fire onConnectError if fsockopen fails.
Fix copy/paste error. Do not set socket to null after closing it
Merge pull request #447 from pastoso/master

Handle socket closing and error opening