Fixes path issues with input and output arguments
Fixes path issues with input and output arguments

- Code used to create nonexisting output directories was using basename
  instead of dirname, which caused directories to be created if the file
  specified to --output did not exist.
- The file path passed to jinja2 didn't use an absolute path, this was giving
  'template not found' issues when passing a relative path to jcp.

filipenf/jcp,mpdehaan/jcp,jorisroovers/jcp