In some clearinghouses, there are check fraud rules that provide for "adjustments" after the midnight deadline. The clearinghouse rule modifies the UCC in such cases. One excellent example is the check fraud warranty rule at the Central Oklahoma Clearinghouse Association (COCHA), at
https://www.cocha.org/Services/CheckFraud.aspBut if you don't belong to a group like COCHA with a similar warranty rule, Bank X (from your example) is "on the hook" if it misses the midnight deadline. It's then a matter between Bank X and its customer (and the forger, if he or she can be found).