Fix kernel restart in case connection file is deleted.
Fix kernel restart in case connection file is deleted.

On Mac, the /tmp files are deleted after 3 days if inactivity,
causing qtconsole kernel restart to fail subsequently.
This commit adds check to ensure that connection_file is
written if it does not exist.

ipython/ipython,ipython/ipython