title: Packer doesn't reboot AWS EC2 instance
body: <p>I'm building an AMI with Hashicorp Packer and this are one of the steps:</p>
  
  <pre><code>    {
        "type": "shell",
        "script": "scripts/apt.sh"
      },
      {
        "type": "shell",
        "inline": ["sudo reboot"],
        "inline_shebang": "/bin/bash -e",
        "expect_disconnect": true
      },
      {
        "type": "shell",
        "script": "scripts/sysctl.sh",
        "pause_before": "10s"
      },
  </code></pre>
  
  <p>and here the result:</p>
  
  <pre><code>Provisioning with shell script: scripts/apt.sh
  ==&gt; amazon-ebs: Provisioning with shell script: /tmp/packer-shell376239929
  ==&gt; amazon-ebs: Pausing 10s before the next provisioner...
  ==&gt; amazon-ebs: Provisioning with shell script: scripts/sysctl.sh
      amazon-ebs: net.ipv4.ip_forward = 0
      amazon-ebs: net.ipv4.conf.all.send_redirects = 0
      amazon-ebs: net.ipv4.conf.default.send_redirects = 0
  </code></pre>
  
  <p>It is pretty visible that Packer doesn't somehow interpret the reboot command but immediately run the next command even though I put there the pause attribute. It waits for that 10sec but then no reboot happens.</p>
  
  <pre><code>    amazon-ebs: + sudo reboot now
  2018/01/31 20:54:34 ui:     amazon-ebs: + sudo reboot now
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 Remote command exited without exit status or exit signal.
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 [INFO] RPC endpoint: Communicator ended with: 2300218
  2018/01/31 20:54:34 [INFO] 0 bytes written for 'stdout'
  2018/01/31 20:54:34 [INFO] 18 bytes written for 'stderr'
  2018/01/31 20:54:34 [INFO] RPC client: Communicator ended with: 2300218
  2018/01/31 20:54:34 [INFO] RPC endpoint: Communicator ended with: 2300218
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 [INFO] 0 bytes written for 'stdout'
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 [INFO] 18 bytes written for 'stderr'
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 [INFO] RPC client: Communicator ended with: 2300218
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 opening new ssh session
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 ssh session open error: 'EOF', attempting reconnect
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 reconnecting to TCP connection for SSH
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 handshaking with SSH
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 handshake complete!
  2018/01/31 20:54:34 packer: 2018/01/31 20:54:34 [INFO] no local agent socket, will not connect agent
  2018/01/31 20:54:35 packer: 2018/01/31 20:54:35 starting remote command: rm -f /tmp/script_5069.sh
  2018/01/31 20:54:35 packer: 2018/01/31 20:54:35 [INFO] RPC endpoint: Communicator ended with: 0
  2018/01/31 20:54:35 [INFO] RPC client: Communicator ended with: 0
  2018/01/31 20:54:35 [INFO] RPC endpoint: Communicator ended with: 0
  2018/01/31 20:54:35 packer: 2018/01/31 20:54:35 [INFO] RPC client: Communicator ended with: 0
  2018/01/31 20:54:35 [INFO] (telemetry) ending shell
  2018/01/31 20:54:35 [INFO] (telemetry) Starting provisioner file
  2018/01/31 20:54:35 ui: ==&gt; amazon-ebs: Pausing 10s before the next provisioner...
  ==&gt; amazon-ebs: Pausing 10s before the next provisioner...
  2018/01/31 20:55:05 ui: ==&gt; amazon-ebs: Uploading conf =&gt; /tmp
  ==&gt; amazon-ebs: Uploading conf =&gt; /tmp
  2018/01/31 20:55:05 packer: 2018/01/31 20:55:05 Upload dir 'conf' to '/tmp'
  2018/01/31 20:55:05 packer: 2018/01/31 20:55:05 opening new ssh session
  2018/01/31 20:55:32 packer: 2018/01/31 20:55:32 ssh session open error: 'ssh: unexpected packet in response to channel open: &lt;nil&gt;', attempting reconnect
  2018/01/31 20:55:32 packer: 2018/01/31 20:55:32 reconnecting to TCP connection for SSH
  2018/01/31 20:55:32 packer: 2018/01/31 20:55:32 reconnection error: dial tcp 10.211.207.8:22: getsockopt: connection refused
  2018/01/31 20:55:32 [INFO] (telemetry) ending file
  2018/01/31 20:55:32 [INFO] (telemetry) found error: dial tcp 10.211.207.8:22: getsockopt: connection refused
  ==&gt; amazon-ebs: Terminating the source AWS instance...
  </code></pre>