Now after starting application PID file will be created

Fixes gh-550
Add parent directory creation

Also tidied a few other things up (like not needing
SmartApplicationListener).

Fixes gh-550