"Now credit memo is showing in undeposited funds account."
This happens when you put an Item on the credit memo that is linked to Bank or UF. That item is supposed to be linked, most times at least, to Income. It is the Reversal of a sale, so that makes it Negative Income. Then, issuing the check from the top of the credit memo clears the AR balance credit available, created by the credit memo.
Since this is a Closed Period, you would fix it like this: Select it for deposit, and on the next blank line, using a Negative value, post to some misc Expense account.
What you did is bypass the "sales function" for that "Sales Reversal" activity. Example:
Make an Other Charge type item linked to one income account for Refund/Write Off, to use on a Credit Memo when you do not want to list the original Sold charge item, such as Inventory that never arrived, arrived broken, was never delivered at all, etc. Or, for Services sold, you list the original Service for the Credit memo = the reversal.
Invoices using an item linked to Banking look in banking like a check. Credit Memos using an item linked to banking look like Deposits. Both of these just bypassed the Sales functions.