Apple has designed the 3D touch screens on newer models of the iPhone such as iPhone 6S, iPhone 6S Plus, iPhone 7 and iPhone 7 Plus models to have adjustable screen sensitivity. If your phone is acting unexpectedly when closing the cover of your case, this can be easily solved by adjusting the sensitivity of the touchscreen in your phone settings. Go to Settings > General > Accessibility > 3D Touch. You can either turn this feature completely OFF or set the sensitivity slider to FIRM to make the the 3D touch screen less sensitive.
This is only applicable for the iPhone 6S, iPhone 6S Plus, iPhone 7 and iPhone 7 Plus models.