Fixing some more obscure bugs and corner cases.
Setting state to STATE_CLOSING when sending a close frame.