Fixed a bug in spawn command in lib/modules.coffee

Spawned processes were considered terminated on the 'exit' event.
This causes erratic behaviour as the process might still not have
completed outputting to stdout.So I changed it to listen on the
'close' event which is emitted when all stdio streams of the process
has terminated according to the official docs for node v0.10 at:

http://nodejs.org/api/child_process.html#child_process_event_close