Fix assertion - open() can return "0", which is a valid file descriptor.

Fixes #1781