Bug fix: Close current working contract when creating a new one