If you are getting the issue of "User Error: Some transactions have not been committed or rolled back" while backing up the code and database please check that you have enough disk space to store the backup of magento 2 because I was getting the same error when taking backup after migrating the data.