Ensure JSR356 session is open before writing to it

Patch is incorrect as you will loose the message if isOpen return `false`. You must throw an IOException in that case.