Fixes #1709. When the node returned an error the reject method was not called. Hence, the process kept running forever.