Added some error exception handling to handle errors when the programmes are opened in the wrong sequence