Fix for issue 1243

I believe this will mostly fix issue #1243 however the filenames still aren't what is desired, that can be another issue I think. This adds the ability to turn on debug for gem compiles and also fixes an early free of the irep->filename.