It's always best to pray every prayer on time. However, if you still on the time span between two prayers, your prayer is valid. Consider that the time span between Maghreb and Isha is very short, so it's good when you pray that prayer on time. Time for Maghreb ends, when the redness of the sky vanishes. It's also recommended to postpone Isha a bit, but you need to pray before midnight.
Maybe someone with more knowledge can provide you with more detailed information.
Allahu Alem.