Update dotNET executable to wait for the Casper process to exit

Add check to dotNET application to make sure the CasperJS process has exited before trying to return the exit code.
Source: http://stackoverflow.com/a/65070