This movie is a remake of the 2012 short film, Curfew, in which Shawn Christensen and Fatima Ptacek also played Richie and Sophia. However the Sophia character is now a teenager rather than a little girl.
Despite the film being very similar to the short, the endings of each are different. After Richie plugs the phone back in in the short, his reaction to the call is angry, making the ending comedic and it clear that Richie wants to die but now has something preventing him from doing so. In the film, the ending is much more heartfelt, with Richie deciding he wants to live and let go of his past.
Even if Richard had been given the zolpidem he asked for, 20 pills would not have been enough to cause a fatal overdose. Excluding all other outside factors, the average adult would have to take over 1,000 10mg pills to have a fatal overdose.