Improve message on nonempty queue + fix child hanging on stdin

1. Improve the error reported when the child process exits before the
whole queue is processed.

2. Add a command to close child's stdin stream.