Added spawn event. Change return value to instance
Fixed bug while send result to main process if socket already closed.

Closes #6