Fix jruby pending test

`close` seems the right solution for the problem with sockets.
Also the was a problem with pipe in client.rb. We don't need
@write_io in parent process but if we close it after spawning
we don't see any output from subprocess on jruby, mri works
properly. `IO.popen` also gives an ability to refactor code and
works for all platforms.