Ok go to tools and then go to manage emulators select JNES and then click edit. Go to the autohotkey tab and paste this code in you can change the nullDC to JNES if you want but it isn't necessary that is just for documentation.
; This section closes nullDC when pressing Escape
$Esc::
{
Process, Close, {{{StartupEXE}}}
}