Don't free NULL libwaio pointer

It seems waio_alloc can fail when the input handle is a console. waio_free crashes if given a NULL pointer, so check for NULL before freeing.