What happens to cabin pressurisation when the engines fail?
Closing the outflow valve would seal up the plane, so it wouldn't depressurize immediately. Once the pressure falls below a safe threshold the oxygen masks would drop. The masks are good for about 15 minutes.

Air Transat flight 236 which ran out of fuel over the Atlantic holds the record for the longest unpowered glide in an airliner. It lasted about 19 minutes. 

The APU can provide pressurization, but if you're out of fuel that won't work either. Air Transat was running off the RAT and I doubt that can provide pressurization. BUT if you factor in the outflow valves being closed and the last part of the glide being below 10,000 feet the oxygen masks will provide ample time for the passengers to stay safe.