When the "last" month it will depend on your rental agreement, if any, and when you may have given notice that you were vacating. The security deposit is a different issue and that depends on whether or not it was handled properly by the landlord, as well as if there was any damage to the apartment.
You should speak to an attorney about your matter so you can provide specifics in confidence. I speak to client with matters such as these at no cost or obligation.
DISCLAIMER: This answer is provided in response to a "hypothetical" question and provided for general, informational purposes and does not create an attorney/client relationship. The information presented is not legal advice and may change based additional information and research. It is recommended that you speak to an attorney to discuss your specific legal issues.