Fix tests incompatible with latest WebSocket spec.

The tests call WebSocket.close() and expect to get an
onmessage event after the call and before the
connection is closed. This can not happen according to
the WebSocket spec.

There are two important points:

The first point is what WebSocket.close() is supposed
to do:
http://www.w3.org/TR/websockets/#dom-websocket-close

3. -> Otherwise section applies in all tests:
"Set the readyState attribute's value to CLOSING"

The other point is what happens when readyState is
not OPEN:

http://www.w3.org/TR/websockets/#feedback-from-the-protocol

"When a WebSocket message has been received ... follow
these steps:

1. If the readyState attribute's value is not OPEN, then
    abort these steps."

 Chromium aborts at step one, preventing any further
 onmessage events. The event handler would be called in
 step 5.

 All these tests call WebSocket.close() before the onmessage
 event is received, preventing the event to be delivered.

Move the call to WebSocket.close() to the end of the
onmessage event handler.

BUGS=XWALK-2208