Thanks. Found the bug. It happens only in this special combination (leveling of landscape images which have the orientation flag set to portrait mode).
This is fixed in repository and should be in next version (2015.0 beta 3 or rc1).
Thomas
PS: Your script has a lot room for improvements.
1.) The Hugin parts runs too much commands. The following 4 lines should be sufficient
cpfind --prealigned -o panorama1.pto panorama1.pto
cpclean -o panorama1.pto panorama1.pto
pto_var --opt y,p,r,v,b,c,d,e -o panorama1.pto panorama1.pto
autooptimiser -n -m -l -o panorama1.pto panorama1.pto
This should reduce the overhead.
2.) I don't know what you want to achieve with the first convert line:
convert panorama.tif -gravity north -extent 7762x3881 panorama.tif
nona and enblend should already generate an image with this dimension because your pto file contains ..w7762 h3881..