Replace deprecated g_io_channel_close with g_io_channel_shutdown.

g_io_channel_close flushes the buffer and does not return errors.
g_io_channel_shutdown(handle, TRUE, NULL) keeps that behavior.