Merge pull request #205 from giseburt/advanced

Fixing up flow control changes.
Initial fixes for close() bug.