Improved error handling and fixed a reference leak in :func:`os.posix_spawn()`.