lib: spawn(): Fix fd leak and stupid error handling
if init_stack() fails, the error handling code will only call
sys_env_destroy() and continue! Yes, it'll go ahead and try to
setup the just created child...
Also, we're leaking the binary file's file descriptor in the child
because sys_exofork() and copy_shared_pages() will duplicate the
(still valid) fd's mapping into the child.
In order to fix both problems, this change introduces a new error
handling code, calls sys_exofork() before calling open() and closes
the file descriptor before calling copy_shared_pages().
Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@gmail.com>