Fixing merge procedure - working now

Fixing merge procedure - couple of typos, try to open closed file etc. Seems working now - tested with couple mergings locally.