Actually the problem is more complex than that. You have to understand that almost every server out there is not made to be used as image hosting because people often get a cheap 10USD server and they just notice the unlimited bandwidth and they forget to read the fine print. On this servers this kind of scripts are a pain in the ass because they use too much resources (mostly for the image handling features) and if you set a limit way over 10 this means that you will stress the server too much, and the response of the server is just is natural way to handle the high load... It simply terminates the execution for a while and when this happens you notice this problems.
You have to understand that the servers are not unlimited machines. If you want to handle a queue size of 40 you should have a server able support that. Just picture what will happen if just two persons upload files at the same time, the stress over that cheap server is huge. That's why a limit of 10 files is better because you will need 4 people to cause this stress.
All this depends on the server. If you have a dedicated server you have way more resources than a shared host so you can tune the server to use more machine in PHP and therefore handle way more load. But this is not a script problem is a limitation that rely on the machine you are on and how you handle the request, if you have a stock apache is likely that you will get this problems, you can get a better setup like a nginx proxy and so on. Usually the servers also measure the application memory that they will give you but even expensive hosting can have this problems if you are in a shared hosting, if your neighbors also use a lot the machine you will get less machine to handle the process.
I just wanted to clarify why you are getting this error.