Remove trailing spaces.
Expose phantom.on to the phantom proxy.
Close server when phantom crashes (exit with code 1).